Malik

Kubernetes Command

August 26, 2021

Node, Pod, Label, Annotation

All labels can be applied not only to the pod

All annotations can be applied not only to pods

Pod and Node

View the node

$ kubectl get nodes

See the pod

$ kubectl get pods

View pod by displaying label

$ kubectl get pods --show-labels

Search for pods based on labels

$ kubectl get pods -l key 

Make a pod

$ kubectl create -f nama-file-pod.yaml

Create pods in certain namespaces

$ kubectl create -f nama-file-pod.yaml --namespace nama-namaspace

View the description of the pod

$ kubectl describe pod nama-pod

Delete pod

$ kubectl delete pod nama-pod

Delete all pods in the namespace

$ kubectl delete pod --all --namespace nama-namepace

Namespace

View the namescape

$ kubectl get namespaces

Or likethis

$ kubectl get ns

See pods in certain namespaces

$ kubectl get pods -n nama-namespace

Create namespace

$ kubectl creat -f nama-file-namespace.yaml

Delete namespace

$ kubectl delete namespace nama-namespace

Probe

So there are 3 probes :

  • livenessProbe Health check, if it’s not healthy then the pod will be restarted
  • readinessProbe Health check, if the pod is not healthy the traffic will be turned off
  • startupProbe Health check when pod runs (at startup)

There are many more commands for Kubernetes. The above commands are only a few.


Hi there, I'm Malik. This website just to write simple things of what I've done.