Skip to content

Instantly share code, notes, and snippets.

@tankibaj
Last active April 9, 2021 12:33
Show Gist options
  • Save tankibaj/f76cbbd14f48f69e6883d67a9f6fd5c4 to your computer and use it in GitHub Desktop.
Save tankibaj/f76cbbd14f48f69e6883d67a9f6fd5c4 to your computer and use it in GitHub Desktop.

kubectl commands

kubectl get all

kubectl get nodes

kubectl get pod

kubectl get services

kubectl create deployment nginx-depl --image=nginx

kubectl get deployment

kubectl get replicaset

kubectl edit deployment nginx-depl

debugging

kubectl logs {pod-name}

kubectl exec -it {pod-name} -- bin/bash

kubectl describe pod {pod-name}

kubectl get pod -o wide

kubectl get pod --watch

create mongo deployment

kubectl create deployment mongo-depl --image=mongo

kubectl logs mongo-depl-{pod-name}

kubectl describe pod mongo-depl-{pod-name}

delete deplyoment

kubectl delete deployment mongo-depl

kubectl delete deployment nginx-depl

create or edit config file

vim nginx-deployment.yaml

kubectl apply -f nginx-deployment.yaml

kubectl get pod

kubectl get deployment

delete with config

kubectl delete -f nginx-deployment.yaml

Metrics

kubectl top The kubectl top command returns current CPU and memory usage for a cluster’s pods or nodes, or for a particular pod or node if specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment