Is there any plan
command in Kubernetes? With terraform plan
command we know which resources will be added and removed before applying changes. Is there any similar in Kubernetes?
You can use the --dry-run flag to preview the object that would be sent to your cluster, without really submitting it. Refer https://kubernetes.io/blog/2019/01/14/apiserver-dry-run-and-kubectl-diff/ and https://kubernetes.io/docs/reference/using-api/api-concepts/#dry-run
Kubectl accepts a flag --dry-run=client|server
which is similar. Using --dry-run
flag alone is deprecated in v1.18 and generates a warning (https://kubernetes.io/blog/2019/01/14/apiserver-dry-run-and-kubectl-diff/)
For example: kubectl run nginx --image=nginx --dry-run=client
If client strategy, only prints the object that would be sent, without sending it. If server strategy, submit a server-side request without persisting the resource.
Reference: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands