Verifying the Deployment
Checking the Deployment Status
After creating the Nginx deployment, you can check its status using the kubectl get deployments
command:
kubectl get deployments
This will show you the current status of the deployment, including the number of replicas, the container image, and the age of the deployment.
Inspecting the Deployment Details
To get more detailed information about the Nginx deployment, you can use the kubectl describe deployment
command:
kubectl describe deployment nginx-deployment
This will provide you with detailed information about the deployment, including the pod template, the container specifications, and any events related to the deployment.
Accessing the Nginx Service
To access the Nginx service running in the Kubernetes cluster, you can use the kubectl get services
command to list all the services in the cluster:
kubectl get services
This will show you the service that has been created for the Nginx deployment. You can then use the service's IP address or hostname to access the Nginx application.
Scaling the Deployment
If you need to scale the Nginx deployment, you can use the kubectl scale
command:
kubectl scale deployment nginx-deployment --replicas=3
This will scale the Nginx deployment to 3 replicas, ensuring that there are 3 instances of the Nginx container running in the Kubernetes cluster.
By following these steps, you can verify that the Nginx deployment has been created successfully and learn how to interact with the deployment to scale it or access the Nginx service.