If you’re looking for Kubernetes Cluster for your local development then kind is the best choice. Basically, kind was primarily designed for testing Kubernetes itself but may be used for local development or CI. In this post, we take look steps on how to configure, deploy sample application onto to kind cluster.
kind is more like Minikube which is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node. Minikube is available for Linux, macOS, and Windows systems.
Quick Snapshot
Stable binaries for kind are available on the releases page. To install, download the respective binary for your platform and place into your $PATH
. Here I’m using Linux so I have downloaded *amd64
binary release.
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64
chmod +x ./kind
mv ./kind /some-dir-in-your-PATH/kind
Once the binary is downloaded place kind binary into your $PATH.
kind
does not require kubectl
, but you will not be able to continue on the below sample deployment.
kubectl
is the Kubernetes command-line tool that allows you to run commands against Kubernetes clusters. You can use kubectl
to deploy applications, inspect and manage cluster resources, and view logs.
Download the latest release of kubectl
with the following command:
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
Make the kubectl
binary executable chmod +x ./kubectl
and Move the binary into your PATH sudo mv ./kubectl /usr/local/bin/kubectl
To check if the kubectl
configuration is successful, run kubectl
from the terminal.
Now that we have the basic setup ready, we can set up a new cluster. kind create cluster
command would create a new cluster. This command will bootstrap a Kubernetes cluster using a pre-built node image.
By default, the cluster will be named as kind
. If you wish to name it differently, use the --name
flag to assign a different context name.Use kubectl
command to inspect the cluster that we have created.
In order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster but here if you have noticed,I have supplied --context
to the command to look for the cluster.
You can also check the nodes in the cluster using kubectl get nodes
command.
Let’s run our first app on Kubernetes cluster with the kubectl apply
command. The apply
command creates a new deployment. We need to provide the deployment YAML configuration, I have provided one of the sample Nginx application.
Congrats! We have just deployed the first application by creating a deployment. Following is what the command has done for us:
Here is the deployment configuration that we have deployed:
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80
Once the application instances are created, a Kubernetes Deployment Controller continuously monitors those instances. If the Node hosting an instance goes down or is deleted, the Deployment controller replaces it.
To list your deployments, use the get deployments command:
Some of the useful kubectl
commands are below.
To expose the app on to the outside world, use expose deployment command. Pods that are running inside Kubernetes are running on a private, isolated network. By default, they are visible from other pods and services within the same Kubernetes cluster, but not outside that network.
To see the Nginx landing page, you can do so by navigating to the http://localhost:80
To delete the app, run delete deployment command:
kubectl delete deployment nginx-deployment
For deleting the cluster,use the following command:
kind delete cluster
Like this post? Don’t forget to share it!
There are few things as valuable to a business as well-designed software. Organizations today rely…
The cryptocurrency industry is being reshaped by the fusion of blockchain technology and artificial intelligence…
Introduction Artificial Intelligence (AI) has also found its relevance in graphic design and is quickly…
Imagine a world where the brilliance of Artificial Intelligence (AI) meets the unbreakable security of…
In today’s fast-paced digital landscape, automation is not just a luxury but a necessity for…
The world of casino gaming has leveraged the emerging technology advancements to create immersive and…
This website uses cookies.