When we run the below command from root user in kubernetes master node:
- kubectl create deployment nginx –image=nginxD
on which path the yaml file gets stored ?
- kubectl get deployment nginx -o yaml
from which path it provides us the yaml body ?
When we run the below command from root user in kubernetes master node:
on which path the yaml file gets stored ?
from which path it provides us the yaml body ?
2
Answers
It’s never going to create any yaml. It’s create a deployment. when you run this
kubectl get deployment nginx -o yaml
. The deployment just showed in yaml format.Raw k8s stores everything within etcd. When running commands like
kubectl get deployment nginx -o yaml
kubectl talks to the kubeapi which talks to etcd to get the yaml for you.etcd is a key-value store so any
kubectl get XYZ
is reading a specific key. Anykubectl create XYZ
is creating a new key/value within etcd.Because of the importance of etcd within k8s, it is heavily recommended you back it up in production environments.
The components and how they talk to everything can be found here: https://kubernetes.io/docs/concepts/overview/components/