Deployments are one of the powerful orchestration tools offered by Kubernetes. In this lesson, we will make sure that deployments are working in our cluster. We will verify that we can create a deployment, and that the deployment is able to successfully stand up a new pod and container.
For this lesson, you will need to connect to cluster using
kubectl. You can log in to one of your controller server and use
kubectl there, or you can use
kubectl from your local machine. To use
kubectl from your local machine, you will need to open an SSH tunnel. You can open the SSH tunnel by running this in a separate terminal. Leave the session open while you are working to keep the tunnel active:
ssh -L 6443:localhost:6443 user@<your Load balancer cloud server public IP>
Create a a simple nginx deployment:
kubectl run nginx --image=nginx
Verify that the deployment created a pod and that the pod is running:
kubectl get pods -l run=nginx
Verify that the output looks something like this:
NAME READY STATUS RESTARTS AGE nginx-65899c769f-9xnqm 1/1 Running 0 30s
The pod should have a STATUS of
Running with 1/1 containers READY.