What you’ll Learn

What You’ll Need

Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling and managing of containerized apps.

img.png

Now that we have an understanding what K8s let’s deploy our own cluster!

img.png

kind is a tool for running local Kubernetes clusters using Docker container “nodes.” kind was primarily designed for testing Kubernetes itself, but it may be used for local development or CI.

  1. This sample cluster YAML file is used with kind to config and build our cluster.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 30201
    hostPort: 30201
    listenAddress: "0.0.0.0"
  1. It’s time to deploy our first cluster! Leveraging the kind-config.yaml to do so:
    • Open a new Terminal
    • Navigate to the location of kind-config.yaml using cd <directory> in your Terminal
    • Create the cluster by entering the following command in your Terminal
kind create cluster --name my-kubernetes-cluster --config kind-config.yaml

deploy

  1. You now have a working Kubernetes cluster. Confirm that the my-kubernetes-cluster cluster was created, using your terminal execute:
kind get clusters
  1. Configure kubectl so we can interact with it, in your terminal execute:
kubectl cluster-info --context kind-my-kubernetes-cluster
  1. Let’s get some information about our cluster using kubectl, in your terminal execute:
kubectl config view --minify --flatten --context=kind-my-kubernetes-cluster

You’ve made it this far! now that we have a Kubernetes cluster! we need a way to interact with it the standard command line employed to communicate with it is Kubectl

In your terminal, let’s try some commonly used kubectl commands!

Cluster Management

kubectl cluster-info
kubectl version
kubectl config view
kubectl api-resources
kubectl get all

Namespaces

In Kubernetes, namespaces provide a mechanism for isolating groups of resources within a single cluster.

kubectl create namespace my-first-ns
kubectl get namespaces
kubectl describe namespace my-first-ns
kubectl delete namespace my-first-ns

ℹ️ For a complete list of kubectl commands and to learn more, check out this Cheat Sheet.

Congratulations! You’ve successfully completed this lab!

Learn More