Other Login Methods

Last updated: 2020-02-24 19:32:29

PDF

Log in to the container through the web terminal (recommended)

  1. Log in to the TKE console and select Clusters In the left sidebar.
  2. On the Cluster Management page, click Cluster ID (cls-xxx) to enter the cluster details page.
  3. On the cluster details page, select * * Node Management * *-> * * Node * * in Left sidebar.
  4. On the Node list page, select the node to which the container belongs, click to go to the Pod Management details page, view the instance list, select the container and log in to the remote terminal, as shown in the following figure.

    For FAQs about the remote terminal, please View here .

Remote login is not supported for containers that meet any of the following criteria:

  • The namespace is kube-system.
  • There is no built-in bash in container Image.

Alt text

Logging in to Container via the Container's Node

  1. Obtain the IP address of the node where the container resides and the container's ID.
    Alt text

  2. Log in to the node. For more information, see Logging in to CVM.

  3. Run the docker ps command to view the container you want to log into.

    [root@VM_88_88_centos ~]# docker ps | grep 75b3b15af61a  
    75b3b15af61a       nginx:latest                                 "nginx -g 'daemon off"   About a minute ago   Up About a minute                       k8s_worid.e8b44cc_worid-24bn2_default_81a59654-aa14-11e6-8a18-52540093c40b_42c0b746
  4. Run the docker exec command to log into the container.

    [root@VM_0_60_centos ~]# docker ps | grep 75b3b15af61a
    75b3b15af61a        nginx:latest                                 "nginx -g 'daemon off"   2 minutes ago       Up 2 minutes                            k8s_worid.e8b44cc_worid-24bn2_default_81a59654-aa14-11e6-8a18-52540093c40b_6b389dd2
    [root@VM_0_60_centos ~]# docker exec -it 75b3b15af61a /bin/bash
    root@worid-24bn2:/# ls
    bin  boot  dev    etc  home  lib    lib64  media  mnt  opt    proc  root  run  sbin  srv  sys  tmp  usr  var

The container has installed the SSH server. Log in to the container through SSH

  1. Obtain the IP address of the container.
    Alt text

  2. Log in to any node in the cluster. For more information, see Logging in to CVM.

  3. Log in to the container via SSH.