Skip to content

Commit b1a5f31

Browse files
Remove unnecessary step to manually update the service account secrets
Playing with v1.19.16, it seems that updating `--root-ca-file` flag in the kube-controller-manager config and then restart it results in all those Secrets getting updated with the new value.
1 parent 9193053 commit b1a5f31

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

content/en/docs/tasks/tls/manual-rotation-of-ca-certificates.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,11 @@ Configurations with a single API server will experience unavailability while the
5151
kube-controller-manager being unable to accept a CA bundle.
5252
{{< /note >}}
5353

54-
1. Update all Secrets that hold service account tokens to include both old and new CA certificates.
54+
1. Wait for the controller manager to update `ca.crt` in the service account Secrets to include both old and new CA certificates.
5555

5656
If any Pods are started before new CA is used by API servers, the new Pods get this update and will trust both
5757
old and new CAs.
5858

59-
```shell
60-
base64_encoded_ca="$(base64 -w0 <path to file containing both old and new CAs>)"
61-
62-
for namespace in $(kubectl get namespace --no-headers -o name | cut -d / -f 2 ); do
63-
for token in $(kubectl get secrets --namespace "$namespace" --field-selector type=kubernetes.io/service-account-token -o name); do
64-
kubectl get $token --namespace "$namespace" -o yaml | \
65-
/bin/sed "s/\(ca.crt:\).*/\1 ${base64_encoded_ca}/" | \
66-
kubectl apply -f -
67-
done
68-
done
69-
```
70-
7159
1. Restart all pods using in-cluster configurations (for example: kube-proxy, CoreDNS, etc) so they can use the
7260
updated certificate authority data from Secrets that link to ServiceAccounts.
7361

0 commit comments

Comments
 (0)