Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Leen15/2d583058ecc43870c7da5348a3a7404e to your computer and use it in GitHub Desktop.
Save Leen15/2d583058ecc43870c7da5348a3a7404e to your computer and use it in GitHub Desktop.
Remove CATTLE_CA_CHECKSUM from cattle-node-agent DaemonSet
#!/bin/bash
# Check current CATTLE_CA_CHECKSUM value
kubectl -n cattle-system get ds -o go-template='{{range .items}}{{range .spec.template.spec.containers}}{{range .env}}{{if eq .name "CATTLE_CA_CHECKSUM"}}{{.name}}{{"="}}{{.value}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'
# Remove CATTLE_CA_CHECKSUM value
kubectl -n cattle-system patch daemonset/cattle-node-agent -p '{"spec": {"template": {"spec": {"containers": [{"name": "agent", "env": [{"name": "CATTLE_CA_CHECKSUM", "value": ""}]}]}}}}'
# Check changed CATTLE_CA_CHECKSUM value
kubectl -n cattle-system get ds -o go-template='{{range .items}}{{range .spec.template.spec.containers}}{{range .env}}{{if eq .name "CATTLE_CA_CHECKSUM"}}{{.name}}{{"="}}{{.value}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment