0% found this document useful (0 votes)
2 views

Kubernetes Commands

This document provides a comprehensive list of Kubernetes commands specifically for the master node. It includes commands for managing nodes, deploying and accessing Nginx pods, creating and scaling deployments, and retrieving information about pods and deployments. Each command is accompanied by its specific syntax for easy reference.

Uploaded by

aliceboss704
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Kubernetes Commands

This document provides a comprehensive list of Kubernetes commands specifically for the master node. It includes commands for managing nodes, deploying and accessing Nginx pods, creating and scaling deployments, and retrieving information about pods and deployments. Each command is accompanied by its specific syntax for easy reference.

Uploaded by

aliceboss704
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Kubernetes Commands

Master Node Only Commands


1. Get Nodes Information
● List all nodes in the cluster:
kubectl get nodes
● List all nodes with additional details:
kubectl get nodes -o wide
● Describe a node (detailed information):
kubectl describe nodes

2. Deploy an Nginx Pod


● Run an Nginx pod using the latest image:
kubectl run nginx --image=nginx:latest

3. Get Pod Information


● List all running pods:
kubectl get pods

4. Access a Running Pod


● Open an interactive shell session inside the Nginx pod:
kubectl exec -it nginx -- /bin/bash
● Verify the current directory:
pwd

● List all files and directories in the root directory:


ls
5. Exit the Pod Shell
● Exit the interactive shell session:
exit

6. Delete a Pod
● Delete the Nginx pod:
kubectl delete pod nginx
7. Create a Deployment
● Create an Nginx deployment with 4 replicas:
kubectl create deploy nginx --image=nginx:latest --replicas=4

8. Get Deployment Information


● Check the status of the Nginx deployment:
kubectl get deploy nginx
● List all running pods:
kubectl get pods

9. Scale the Deployment


● Scale the Nginx deployment to 2 replicas:
kubectl scale deploy nginx -- replicas=2

10. Verify Scaling


● Check the updated deployment information:
kubectl get deploy
● List the running pods after scaling: kubectl get pods

You might also like