Kubernets command

kubernetes

kubectl commmand >
kubectl Command ResourceType/kind Recourcename(kubectl commmand)

Command get/describe/delete
ResourceType/Kind pod/namespace/replicaset/replicacontroller/deployments/configmap
Name mynameidpod/iamnamespace/iamreplicaset/iamconfigmap/

kubectl get pods (show running pods)
kubectl get pods -w (watch pods)
kubectl delete pod firstpod (delete pod)
kubectl label pod firstpod env=testing (add env in pod)
kubeclt label –overwrite pod firstpod env=prod (update inv)
kubectl label pod firstpod env- (delete env label)
kubectl run firstpod –generator=run-pod/v1 –image=nginx (start new pod)
kubectl label pods –all status=xyz (add label to all pods)
kubectl get pods –show-labels (show all pods with label)
kubectl run firstpod –dry-run –generator=run-pod/v1 –image=nginx (commmand check)
kubectl delete pods –all (delete all pods)
kubectl expalin pods (expain about pod)
kubectl create -f firstpod.yml
kubectl run secondpod –dry-run –generator=run-pod/v1 –image=nginx -o yaml (genrate yaml file)
kubectl apply -f firstpod.yml (create kubernet pod)
kubectl edit pod myfirstpod (edit running pod)
docker container exec -it ccc000152894 env (show env in container)
kubectl exec myfirstpod env (show env in container)
kubectl exec myfirstpod -it -c containername bash (login container)
kubectl expose pod thirdpod –port=8000 –target-port=80 –name myfirstservice (enable port in runnig container (with in cluster)thirdpod )
kubectl expose pod thirdpod –type=NodePort –port=8000 –target-port=80 –name myfirstservice1 (enabel port in container (with in network) )
kubectl get svc (check enable port in cluster)
kubectl delete pod –all (delete all pod)
kubectl delete rc –cascade=false firstreplicationcontroller (delete rc only without pods)
kubectl get pods -o wide –show-labels (show all pods)
kubectl edit rc firstreplicationcontroller {change replicase to 7} (change replicas no from rc edit command)
kubectl replace -f firstrc.yml (update replica set)

<<<<<<<<>>>>>>>>>firstpod.yml
apiVersion: v1
kind: Pod

metadata:
name: myfirstpod
labels:
env: prod

spec:
containers:
– name: containername
image: nginx

kubectl explain pod –recursive | less

Be the first to comment

Leave a Reply

Your email address will not be published.


*