Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save superseb/e9f2a0b13cce55946201ade5ae24a500 to your computer and use it in GitHub Desktop.
Save superseb/e9f2a0b13cce55946201ade5ae24a500 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