1.

How do you test a manifest without actually executing it?

Answer»

use --dry-run flag to test the manifest. This is really useful not only to ensure if the yaml syntax is right for a particular Kubernetes object but also to ensure that a spec has required key-value pairs.

kubectl create -f <test.yaml&GT; --dry-run

Let us now look at an example Pod spec that will launch an NGINX pod

○ → cat example_pod.yaml --- apiVersion: v1 kind: Pod metadata:   name: my-nginx   namespace: mynamespace spec:   CONTAINERS:     - name: my-nginx       IMAGE: nginx ○ → kubectl create -f example_pod.yaml --dry-run pod/my-nginx created (dry run)


Discussion

No Comment Found

Related InterviewSolutions