You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate POD Manifest YAML file (-o yaml). Don’t create it(–dry-run)
kubectl run pod-name --image=nginx --dry-run=client -o yaml > file-name.yml
Get POD Details
# To get basic details
kubectl get pod
# To get complete details
kubectl describe pod pod-name
To edit/update that POD
Way One(Permanent)
# Create the YAML file from POD Details
kubectl get pod pod-name -o yaml > file-name.yml
# Next with VI/Nano editor you can update that file# After that first delete the older POD
kubectl delete pod pod-name
# Then create new POD with edited file
kubectl apply -f file-name.yml
# To get basic details
kubectl get deployment
# To get complete details
kubectl describe deployment deployment-name
To edit/update that Deployment
Way One(Permanent)
# Create the YAML file from POD Details
kubectl get deployment deployment-name -o yaml > file-name.yml
# Next with VI/Nano editor you can update that file# Then just apply changes
kubectl apply -f file-name.yml
# Command Pattern : kubectl expose pod pod-name --type=ClusterIP --port=80 --name service-name# For Cluster IP
kubectl expose pod pod-name --type=ClusterIP --port=80 --name service-name
# For NodePort
kubectl expose pod pod-name --type=NodePort --port=80 --name service-name
# Note : With expose command we can't mention the NodePort.# Note : We can't directly bind replicaset and deployment to service with imperative commands because selector option is not available.
# Command Pattern : kubectl create service service-type service-name --tcp=80:80 --dry-run=client -o yaml > file-name.yml# For Cluster IP
kubectl create service clusterip service-name --tcp=80:80 --dry-run=client -o yaml > file-name.yml
# For NodePort
kubectl create service nodeport service-name --tcp=80:80 --node-port=30080 --dry-run=client -o yaml > file-name.yml
# For Load Balancer
kubectl create service loadbalancer service-name --tcp=80:80 --dry-run=client -o yaml > file-name.yml
# Note : We can't mention the selector in imperative commands. So first we have to create definition file and then we can edit that file and define selector.# To create object
kubectl create -f file-name.yml
Get Service Details
# To get basic details
kubectl get service
# To get complete details
kubectl describe service service-name
To edit/update that Service
Way One(Permanent)
# Create the YAML file from POD Details
kubectl get service service-name -o yaml > file-name.yml
# Next with VI/Nano editor you can update that file# Then just apply changes
kubectl apply -f file-name.yml