Skip to content

Commit 75c5998

Browse files
authored
fix: errors in base64 and sed commands
* All base64 commands need `-w0` argument or else the base64_encoded_ca bash variable will contain space chars (" ") where newlines were * All sed command are missing final "/" at the end of the expression. Command fails with the following error ```bash /bin/sed: -e expression #1, char 95: unterminated `s' command ```
1 parent f1b006f commit 75c5998

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ Configurations with a single API server will experience unavailability while the
5151
If any pods are started before new CA is used by API servers, they will get this update and trust both old and new CAs.
5252

5353
```shell
54-
base64_encoded_ca="$(base64 <path to file containing both old and new CAs>)"
54+
base64_encoded_ca="$(base64 -w0 <path to file containing both old and new CAs>)"
5555

5656
for namespace in $(kubectl get ns --no-headers | awk '{print $1}'); do
5757
for token in $(kubectl get secrets --namespace "$namespace" --field-selector type=kubernetes.io/service-account-token -o name); do
5858
kubectl get $token --namespace "$namespace" -o yaml | \
59-
/bin/sed "s/\(ca.crt:\).*/\1 ${base64_encoded_ca}" | \
59+
/bin/sed "s/\(ca.crt:\).*/\1 ${base64_encoded_ca}/" | \
6060
kubectl apply -f -
6161
done
6262
done
@@ -132,10 +132,10 @@ Configurations with a single API server will experience unavailability while the
132132
1. If your cluster is using bootstrap tokens to join nodes, update the ConfigMap `cluster-info` in the `kube-public` namespace with new CA.
133133

134134
```shell
135-
base64_encoded_ca="$(base64 /etc/kubernetes/pki/ca.crt)"
135+
base64_encoded_ca="$(base64 -w0 /etc/kubernetes/pki/ca.crt)"
136136
137137
kubectl get cm/cluster-info --namespace kube-public -o yaml | \
138-
/bin/sed "s/\(certificate-authority-data:\).*/\1 ${base64_encoded_ca}" | \
138+
/bin/sed "s/\(certificate-authority-data:\).*/\1 ${base64_encoded_ca}/" | \
139139
kubectl apply -f -
140140
```
141141

0 commit comments

Comments
 (0)