Create a Deployment in Kubernetes With Kubectl

Deployments are rolling updates for your applications.  As the name implies, “deployment” manages how to deploy or migrate your stateless applications that may need to be upgraded with zero downtime.  This is useful when you want an immutable infrastructure and want to keep it up-to-date without any downtime.

The deployments design pattern allows us to create a baseline for our application (e.g., Docker image) and then use it as a reference for creating multiple replicas of our application (i.e., Pods).  All these replicas share the same configuration to expect a certain level of uniformity across all our pods running.

In this post, we will go over how to create a deployment using Kubernetes kubectl command line.

Create a Deployment

kubectl create deployment mywebserver --image=nginx

To check the deployment, we run the get command.

kubectl get pods

To delete a deployment, we use the delete command.

kubectl delete deployments.apps mywebserver

Posted

in

by