Administer > Administer the Container Deployment Foundation > Change the host name of the installed cluster node

Change the host name of the installed cluster node

Follow the steps below to change the host name of the installed cluster node.

Note For ITOM Container Deployment Foundation, the ingress is in core namespace.

  1. Generate a new certificate for the new host name.

    • You can use a certificate signed by your enterprise RootCA.
    • Alternatively, you can generate a self-signed certificate by following the steps below:

      Log on to one of the master nodes and run the following commands:

      cd $K8S_HOME/ssl

      openssl genrsa -out ${hostName}.key 4096

      openssl req -new -key ${hostName}.key -subj "/CN=${hostName}" -out ${hostName}.csr

      openssl x509 -sha256 -req -in ${hostName}.csr -CA "${cacert}" -CAkey "${cakey}" -CAcreateserial -out ${hostName}.crt -days 365

      chmod 0400 ${hostName}.crt ${hostName}.key

      rm -f ${hostName}.csr

  2. Follow the commands below to replace the defect nginx secret.

    kubectl delete secret nginx-default-secret -n core

    echo "

    apiVersion: v1

    kind: Secret

    metadata:

    name: nginx-default-secret

    namespace: core

    data:

    tls.crt: `base64 -w 0 $K8S_HOME/ssl/${hostName}.crt`

    tls.key: `base64 -w 0 $K8S_HOME/ssl/${hostName}.key`

    "| kubectl create -f -

  3. Follow the commands below to restart the ingress container.

    kubectl delete -f $K8S_HOME/objectdefs/nginx-ingress.yaml

    kubectl create -f $K8S_HOME/objectdefs/nginx-ingress.yaml

  4. On all master nodes, replace the hostname in the suite.yaml, mng-portal.yaml, and idm.yaml under the $K8S_HOME/objectdefs directory with the following commands.

    sed -i -e "s/old_hostname/new_hostname/g" $K8S_HOME/objectdefs/idm.yaml

    sed -i -e "s/old_hostname/new_hostname/g" $K8S_HOME/objectdefs/suite.yaml

    sed -i -e "s/old_hostname/new_hostname/g" $K8S_HOME/objectdefs/mng-portal.yaml

  5. On one of the master nodes, restart the idm, suite, and mng-portal with the following commands.

    kubectl delete -f $K8S_HOME/objectdefs/idm.yaml

    kubectl delete -f $K8S_HOME/objectdefs/suite.yaml

    kubectl delete -f $K8S_HOME/objectdefs/mng-portal.yaml

    kubectl create -f $K8S_HOME/objectdefs/idm.yaml

    kubectl create -f $K8S_HOME/objectdefs/suite.yaml

    kubectl create -f $K8S_HOME/objectdefs/mng-portal.yaml