Renew etcd certificates on master nodes to maintain cluster security and avoid service disruptions.
ACK managed Pro clusters handle etcd and control plane certificates automatically. To avoid manual management, migrate to an ACK managed Pro cluster.
Before you begin
-
ACK sends in-app and SMS reminders two months before etcd certificates expiretwo months before etcd certificates expire and displays the Update ETCD Certificate button on the Clusters page.
-
During renewal, control plane components (API Server, etcd, kube-controller-manager, kubelet) restart sequentially on master nodes. Persistent API Server connections are interrupted. Perform during off-peak hours. Takes approximately 30 minutes.
-
If you modified the default etcd or Kubernetes configuration directory, create a symbolic link to the original directory before renewal. Otherwise, renewal fails.
-
If the Update ETCD Certificate reminder persists after manual renewal, submit a ticketsubmit a ticketsubmit a ticketsubmit a ticket to remove it.
-
If renewal fails, submit a ticketsubmit a ticketsubmit a ticketsubmit a ticket for assistance.
Choose a renewal method
| Situation | Recommended method |
|---|---|
| Not yet expired, console accessible | Use the console |
| Not yet expired, console renewal unavailable | Manually renew (Scenario 1) |
| Already expired, API Server may be inaccessible | Manually renew (Scenario 2) |
| Renewal failed, cluster in broken state | Roll back the changes |
Renew certificates from the console
-
Log on to the ACK console. In the left-side navigation pane, click Clusters.
-
Click Update ETCD Certificate next to the target cluster. On the Update Certificate page, click Update Certificate.
The Update ETCD Certificate button appears only when certificates are due to expire within two months.

-
In the Note dialog box, click OK.
After renewal:
-
The Update Certificate page shows Updated Successfully.
-
The Update ETCD Certificate button no longer appears on the Clusters page.
Manually renew certificates
Use manual renewal when:
-
The etcd certificates of the ACK dedicated cluster are about to expire.
-
Console auto-renewal is unavailable.
-
Certificates cannot be renewed by deploying a template.
Run all scripts in this section as the root user.
Prerequisites
Configure password-free SSH logon between master nodes for the root user.
To verify, SSH from one master node to another. If prompted, set up password-free logon:
# Step 1: Generate an RSA key pair. Skip this step if a key already exists on the node.
ssh-keygen -t rsa
# Step 2: Copy the public key to each other master node.
# Replace $(internal-ip) with the internal IP address of the target master node.
ssh-copy-id -i ~/.ssh/id_rsa.pub $(internal-ip)
If skipped, you must enter the root password each time the script connects to a remote node.
Scenario 1: Renew certificates that are not yet expired
Use when etcd certificates are approaching expiration but have not yet expired.
Step 1: Save the scripts
Save the following scripts in the same folder on any master node. Name them restart-apiserver.sh and rotate-etcd.sh.
Therotate-etcd.shscript auto-detects the region from the node's metadata service. To specify it manually, use--region <region-id>.
Step 2: Run the rotation script
On any master node, run:
bash rotate-etcd.sh
If the output ends with etcd CA and certs have successfully rotated!, all master node and Kubernetes component certificates have been renewed.
Step 3: Verify the renewal
cd /var/lib/etcd/cert
for i in `ls | grep pem| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
cd /etc/kubernetes/pki/etcd
for i in `ls | grep pem| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
cd /etc/kubernetes/pki/
for i in `ls | grep crt| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
Renewal is complete if all expiration dates are 50 years in the future.
After manual renewal, the update button may persist because the ACK console cannot detect the result automatically. Submit a ticketSubmit a ticketSubmit a ticketSubmit a ticket to have it removed.
Scenario 2: Renew certificates that have expired
Use when etcd certificates have expired, API Server is inaccessible, template-based auto-rotation is unavailable, or console renewal is unavailable.
Step 1: Save the scripts
Save the following scripts in the same folder on any master node. Name them restart-apiserver.sh and rotate-etcd.sh.
Therotate-etcd.shscript auto-detects the region from the node's metadata service. To specify it manually, use--region <region-id>.
Step 2: Run the rotation script
On any master node, run:
bash rotate-etcd.sh
If the output ends with etcd CA and certs have successfully rotated!, all master node and Kubernetes component certificates have been renewed.
Step 3: Verify the renewal
cd /var/lib/etcd/cert
for i in `ls | grep pem| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
cd /etc/kubernetes/pki/etcd
for i in `ls | grep pem| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
cd /etc/kubernetes/pki/
for i in `ls | grep crt| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
Renewal is complete if all expiration dates are 50 years in the future.
After manual renewal, the expired status may persist because the ACK console cannot detect the result automatically. Submit a ticketSubmit a ticketSubmit a ticketSubmit a ticket to have it removed.
Roll back when certificate renewal fails
Use when console or command-line renewal fails. This procedure generates new etcd certificates and updates the etcd server and kube-apiserver client certificates to restore the cluster.
Run all scripts as the root user. Configure password-free SSH logon between master nodes before proceeding (see Prerequisites).
Step 1: Save the scripts
Save the following scripts in the same folder on any master node. Name them restart-apiserver.sh and rollback-etcd.sh.
Therollback-etcd.shscript auto-detects the region from the node's metadata service. To specify it manually, use--region <region-id>.
Step 2: Run the rollback script
On any master node, run:
bash rollback-etcd.sh
If the output ends with etcd CA and certs have successfully rotated!, the rollback is complete.
Step 3: Verify the rollback
cd /var/lib/etcd/cert
for i in `ls | grep pem| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
cd /etc/kubernetes/pki/etcd
for i in `ls | grep pem| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
cd /etc/kubernetes/pki/
for i in `ls | grep crt| grep -v key`;do openssl x509 -noout -text -in $i | grep -i after && echo "$i" ;done
The rollback is complete if all expiration dates are more than 50 years in the future.