Puede renovar los certificados creados por el instalador después de instalar IBM Cloud Private.
Tipo de usuario o nivel de acceso necesario: administrador de clúster o administrador de equipos
Puede actualizar los certificados de los componentes siguientes:
| Componente | Directorio |
|---|---|
| Entidad emisora de certificados raíz | cluster/cfc-certs/root-ca |
| Etcd | cluster/cfc-certs/etcd |
| Front-Proxy | cluster/cfc-certs/front-proxy |
| Kubernetes | cluster/cfc-certs/kubernetes |
| IPSec | cluster/cfc-certs/ipsec |
| Helm | cluster/cfc-certs/helm |
Verifique que el clúster IBM Cloud Private está en ejecución.
Nota: Al ejecutar el mandato para renovar un certificado, los servicios de gestión relacionados podrían no estar disponibles durante un breve periodo de tiempo. El mandato no afecta a las aplicaciones del clúster.
Lleve a cabo los pasos siguientes para realizar una copia de seguridad de los certificados existentes:
cd <installation_directory>/cluster/
cp -r cfc-certs cfc-certs.bak
Actualice la entidad emisora de certificados anterior: Suprima el certificado de entidad emisora de certificados anterior, ca.crt, ejecutando el mandato siguiente:
rm -rf <cluster_dir>/cfc-certs/root-ca
Suprima los certificados y las claves relacionados con la entidad emisora de certificados anterior. Por ejemplo:
rm -rf <cluster_dir>/cfc-certs/kubernetes
rm -rf <cluster_dir>/cfc-certs/helm
rm -rf <cluster_dir>/cfc-certs/ipsec
Ejecute el mandato siguiente para renovar los certificados root-ca:
Para IBM Cloud Private:
Para Linux, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-amd64:3.2.0-ee \
replace-certificates --tags "root-ca-certs"
Para Linux® on Power® (ppc64le), ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-ppc64le:3.2.0-ee \
replace-certificates --tags "root-ca-certs"
Para Linux® on IBM® Z and LinuxONE, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-s390x:3.2.0-ee \
replace-certificates --tags "root-ca-certs"
Nota: Al renovar la entidad emisora de certificados raíz, se renuevan automáticamente todos los certificados firmados por la entidad emisora de certificados raíz. Estos certificados incluyen Kubernetes, IPSec y Helm.
Reinicie manualmente los servicios volviendo a cargarlos. Se deben volver a cargar todas las señales predeterminadas y los servicios relacionados. Para obtener más información, consulte Recarga de servicios.
Vuelva a crear manualmente el secreto de extracción de imagen. Para obtener más información, consulte Volver a crear el secreto de obtención de imagen
Renueve todos los certificados cert-manager que utilizan la entidad emisora de certificados. Para obtener más información, consulte Renovación de certificados Cert-Manager.
Reinicie Docker
sudo systemctl restart docker
Ejecute el mandato siguiente para reiniciar Kubelet en el nodo maestro.
sudo systemctl restart kubelet
Suprima los certificados anteriores ejecutando el mandato siguiente:
rm -rf <cluster_dir>/cfc-certs/etcd
Ejecute el mandato siguiente para sustituir los certificados etcd:
Para Linux, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-amd64:3.2.0-ee \
replace-certificates --tags "etcd-certs"
Para Linux® on Power® (ppc64le), ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-ppc64le:3.2.0-ee \
replace-certificates --tags "etcd-certs"
Para Linux® on IBM® Z and LinuxONE, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-s390x:3.2.0-ee \
replace-certificates --tags "etcd-certs"
Suprima los certificados anteriores ejecutando el mandato siguiente:
rm -rf <cluster_dir>/cfc-certs/front
Ejecute el mandato siguiente para sustituir los certificados front proxy:
Para Linux, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-amd64:3.2.0-ee \
replace-certificates --tags "front-proxy-certs"
Para Linux® on Power® (ppc64le), ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-ppc64le:3.2.0-ee \
replace-certificates --tags "front-proxy-certs"
Para Linux® on IBM® Z and LinuxONE, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-s390x:3.2.0-ee \
replace-certificates --tags "front-proxy-certs"
Suprima los certificados anteriores ejecutando el mandato siguiente:
rm -rf <cluster_dir>/cfc-certs/kubernetes
Ejecute el mandato siguiente para sustituir los certificados kubernetes:
Para Linux, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-amd64:3.2.0-ee \
replace-certificates --tags "kubernetes-certs"
Para Linux® on Power® (ppc64le), ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-ppc64le:3.2.0-ee \
replace-certificates --tags "kubernetes-certs"
Para Linux® on IBM® Z and LinuxONE, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-s390x:3.2.0-ee \
replace-certificates --tags "kubernetes-certs"
Suprima los certificados anteriores ejecutando el mandato siguiente:
rm -rf <cluster_dir>/cfc-certs/ipsec
Ejecute el mandato siguiente para sustituir los certificados ipsec:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-amd64:3.2.0-ee \
replace-certificates --tags "ipsec-certs"
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-ppc64le:3.2.0-ee \
replace-certificates --tags "ipsec-certs"
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-s390x:3.2.0-ee \
replace-certificates --tags "ipsec-certs"
Suprima los certificados anteriores ejecutando el mandato siguiente:
rm -rf <cluster_dir>/cfc-certs/helm
Ejecute el mandato siguiente para sustituir los certificados helm:
Para Linux, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-amd64:3.2.0-ee \
replace-certificates --tags "helm-certs"
Para Linux® on Power® (ppc64le), ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-ppc64le:3.2.0-ee \
replace-certificates --tags "helm-certs"
Para Linux® on IBM® Z and LinuxONE, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-s390x:3.2.0-ee \
replace-certificates --tags "helm-certs"
Después de sustituir la entidad emisora de certificados raíz, debe suprimir la señal predeterminada de todos los espacios de nombres y reiniciar los servicios relacionados. Puede utilizar el código siguiente para suprimir la señal predeterminada de todos los espacios de nombres y reiniciar los servicios relacionados.
kubectl get secret --no-headers --all-namespaces -o=custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace | grep default-token | while read token; do
secret_name=$(echo $token | awk '{print $1}')
secret_namespace=$(echo $token | awk '{print $2}')
echo "-----------------------------------------------------------------------"
echo "| Token: ${secret_name}"
echo "| Namespace: ${secret_namespace}"
echo "-----------------------------------------------------------------------"
echo "Deleteing default token ..."
kubectl -n ${secret_namespace} delete secret ${secret_name} &>/dev/null
echo "Reloading services ..."
kubectl -n ${secret_namespace} get po --field-selector=status.phase!=Completed,status.phase!=Succeeded,status.phase!=Unknow --no-headers -o=custom-columns=NAME:.metadata.name | while read pod; do
secret_used=$(kubectl -n ${secret_namespace} get po ${pod} -oyaml | egrep 'secretName: default-token|secretName: calico-node-token' &>/dev/null || echo no && echo yes)
if [[ "$secret_used" == "yes" ]]; then
echo " - Restarting pod ${pod} ..."
kubectl -n ${secret_namespace} delete po ${pod} --grace-period=0 --force &>/dev/null
fi
done
echo
done
Para Linux, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-amd64:3.2.0-ee \
image-pull-secret
Para Linux® on Power® (ppc64le), ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-ppc64le:3.2.0-ee \
image-pull-secret
Para Linux® on IBM® Z and LinuxONE, ejecute el mandato siguiente:
sudo docker run --net=host -t -e LICENSE=accept \
-v "$(pwd)":/installer/cluster ibmcom/icp-inception-s390x:3.2.0-ee \
image-pull-secret
Después de sustituir la entidad emisora de certificados raíz, debe renovar todos los certificados firmados por la entidad emisora de certificados raíz, y reiniciar los servicios que utilice esos certificados. Cert-manager crea el ClusterIssuer predeterminado de la entidad emisora de certificados raíz, por lo que todos los certificados emitidos por cert-manager y firmados por el ClusterIssuer predeterminado también se deben renovar.
El código siguiente suprime los secretos de Kubernetes asociados con cada certificado cert-manager para renovar el certificado y reiniciar los servicios que utilizan el certificado.
kubectl get cert --all-namespaces -o custom-columns=:spec.secretName,:metadata.namespace --no-headers -l certmanager.k8s.io/issuer-name=icp-ca-issuer -l certmanager.k8s.io/issuer-kind=ClusterIssuer | while read secret ; do
name=$(echo $secret | awk '{print $1}')
namespace=$(echo $secret | awk '{print $2}')
kubectl delete secret $name -n $namespace
echo "Secret $name was deleted."
hecho