The master nodes of a dedicated Kubernetes cluster are created and maintained by users. To facilitate cluster maintenance and management, Container Service for Kubernetes (ACK) allows you to connect to the master nodes of a dedicated Kubernetes cluster by using SSH. This topic describes how to enable SSH logon over the Internet for a dedicated Kubernetes cluster and how to connect to the master nodes of a dedicated Kubernetes cluster.
PrerequisitesAn elastic IP address (EIP) is associated with the API server of the dedicated Kubernetes cluster. For more information, see Control public access to the API server of a cluster.
- When you create a dedicated Kubernetes cluster, if you select Use SSH to Access the Cluster from the Internet, ACK automatically generates an IP address for you to access the master nodes through SSH. You can view the IP address on the Basic Information tab of the cluster details page. You can use the IP address to log on to the master nodes of the dedicated Kubernetes cluster.
- If you do not enable SSH logon over the Internet when you create the cluster, you must add a listener that listens on SSH port 22 to the Server Load Balancer (SLB) instance of the API server. Then, you can log on to the master nodes of the cluster by using SSH.
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
- On the Cluster Information page, click the Cluster Resources tab. Find APIServerSLB and click the ID of the SLB instance.
- In the left-side navigation pane of the SLB console, choose Listener tab and then click Add Listener.
. Click the The following is an example on how to add a listener that listens on SSH port 22 in a few steps. For more information about listener settings, see Add a TCP listener.
After the listener is added, you can view the listener named tcp_22 on the Listener tab.
- Select TCP as the listener protocol, set Listening Port to 22 (SSH port), and then click Next.
- Select Default Server Group. In the Servers Added section, enter 22 in the Port column for all of the master nodes, set the weights of the master nodes based on your requirements, and then click Next.
- On the Health Check wizard page, click Next.
- On the Confirm wizard page, click Submit.
- On the Instance Details tab of the SLB instance, you can view the public IP address (EIP) of the SLB instance.
You can use SSH to connect to the master nodes of the cluster through the EIP.
- Use the IP address to connect to the master nodes through SSH.
When you create a cluster, you can select the following two logon modes: key pair logon and password logon. For more information, see Create an ACK dedicated cluster. Select a logon mode based on your requirements:
- Password logon: The default username is root. The password is the same as the one that you have specified when you create the cluster.
- Key pair logon: For more information, see Connect to a Linux instance by using an SSH key pair.