Edvin Cekani
Edvin Cekani
Software Developer
Edvin Cekani

Blog

Creating PODs with YAML

Creating PODs with YAML

In order to create YAML file you can use any editor of your choice. I use PyCharm whih is a python editor that has good support for YAML files.

[ pod-definition.yml ]

apiVersion: v1
kind: pod
metadata:
 name:myapp-pod
 labels:
   app:myapp

spec:
 containers:
  -name: nginx-container
   image:nginx


[ kubectl delete deployment nginx ]

PODs Cheatsheet

[ kubectl get pods ] -> Get information about PODs

[ kubectl run nginx --image=nginx ] -> Runs POD with Nginx Image.

[ kubectl describe pod ] -> Shows information about the PODs.

[ kubectl get pods -o wide ] -> Getting in which node the PODs are.

[ kubectl run redis --image=redis123 --dry-run -o yaml ] -> Runs the POD with the image and saves the definition file as yaml file.

[ kubeclt run redis --image=redis123 --dry-run=client -o yaml ] -> Saves the definition file as yaml file.

[ kubectl create -f redis.yaml ] -> Creates Redis Yaml File

[ kubectl apply -f redis.yaml ]  -> Apply the Yaml file.

[ kubectl get pod < pod name >  -o yaml > pod-definition.yaml ]

[ kubectl logs < pod name > ] ->get logs from pod.

[ kubectl logs < pod name > < container name > ] -> get the logs from the container if the pod has two or more containers running.

[ kubectl top node ] -> Provides CPU and Memory consumption of each of the nodes.

[ kubeclt top pod ] -> View performance metrics of the pods in kubernetes

Free Web Hosting