how to test a manifest without actually executing it in kubernetes?

0 votes
I need to test a manifest in order to check the key-value pairs, i need to test it without actually executing it. How can i do this?
Jul 18 in Kubernetes by Sam
• 4,330 points
59 views

1 answer to this question.

0 votes

You can 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> --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)
answered Jul 18 by Sirajul
• 41,000 points

Related Questions In Kubernetes

0 votes
1 answer

How to use gravitational teleport in a container/kubernetes environment?

You can use teleport to augment kubernetes ...READ MORE

answered Jun 28, 2018 in Kubernetes by ajs3033
• 7,280 points
437 views
0 votes
1 answer
0 votes
1 answer

how to scale a statefulset in kubernetes?

Scaling StatefulSets : Use kubectl to scale StatefulSets First, ...READ MORE

answered Jul 23 in Kubernetes by Sirajul
• 41,000 points
262 views
+1 vote
1 answer
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
3,526 views
+3 votes
1 answer
0 votes
1 answer
+1 vote
1 answer

How to deploy a feature with zero downtime in kubernetes?

By default Deployment in Kubernetes uses RollingUpdate as a ...READ MORE

answered Jul 18 in Kubernetes by Sirajul
• 41,000 points
281 views