kubectl get pods, kubectl get deployments, or kubectl get services will not show any new resources until you explicitly apply them.
The output from Kustomize build is solely for previewing your final configuration. To deploy these changes, you must apply them using
kubectl.Deploying Configurations
To deploy the configurations generated by Kustomize, you can pipe its output directly intokubectl apply using the Linux pipe (|) operator. This operator takes the output of one command and passes it as input to the next command. Below is an example demonstrating this approach:
- Runs
kustomize build k8s/to generate the final configuration. - Pipes the output to
kubectl apply -f -, which applies the configuration to your Kubernetes cluster.
-k flag, enabling both methods as shown below:
Removing Configurations
Deleting the deployed resources follows a process similar to deployment. Simply replace theapply keyword with delete. The first method pipes the output of the Kustomize build command directly into kubectl delete:
-k flag:
Always verify that the correct configurations are being applied or deleted by reviewing the Kustomize output before proceeding. This helps in avoiding accidental misconfigurations.