One thing I never realized was the power of kubectl apply.
So if you want to quickly create an element in Kubernetes and avoid the error if the element already exists, you can use the following command (and adapt it to your needs)
kubectl create namespace my-namespace --dry-run=client -o yaml | kubectl apply -f -
If you want more complex elements, you can use an existing file as input.
kubectl apply -f myYaml.yml
And if you want more dynamism, you can use Helm or Kustomize!
- Helm: https://helm.sh/
- Kustomize: https://kustomize.io/
I hope it will help you! 😀
Top comments (0)