I am using jsonnet to describe deployment configuration for Kubernetes.
{
apiVersion: 'apps/v1',
kind: 'Deployment',
metadata: {
name: 'dapi-test-pod',
},
spec: {
selector: {
matchLabels: {
app: 'dapi-test-pod',
},
},
template: {
metadata: {
labels: {
app: 'dapi-test-pod',
},
},
spec: {
containers: [
{
name: 'test-container',
image: 'library/nginx',
},
]
},
},
},
}
Create deployment using kubecfg:
kubecfg show k8s/deployment.jsonnet | kubectl apply -f -
Everything is going well, but is there any great way to delete deployment using kubecfg
and jsonnet
file.
I reproduced your scenario on my cluster and basically the same logic will works for deleting it.
kubecfg show k8s/deployment.jsonnet | kubectl delete -f -
This command will delete everything described in the manifest.
Or you can just delete using bare kubectl:
kubectl delete deployment dapi-test-pod