2020-11-20

My Lab setup:

Pre-req:

Step 1: Change to namespace context.

root@photon-machine [ ~ ]# k config use-context vmc-dzhang
Switched to context "vmc-dzhang".

Step 2: Locate the secret resource

root@photon-machine [ ~ ]# k get secret
NAME                                      TYPE                                  DATA   AGE
default-token-m6pjz                       kubernetes.io/service-account-token   3      12h
dzhang-c01-antrea                         kubernetes.io/tls                     3      11h
dzhang-c01-auth-svc-cert                  kubernetes.io/tls                     3      11h
dzhang-c01-ca                             Opaque                                2      11h
dzhang-c01-ccm-token-v94vt                kubernetes.io/service-account-token   3      11h
dzhang-c01-control-plane-zpzmm            cluster.x-k8s.io/secret               1      11h
dzhang-c01-default-nodepool-gr8tn-j89qs   cluster.x-k8s.io/secret               1      11h
dzhang-c01-default-nodepool-gr8tn-wv5xl   cluster.x-k8s.io/secret               1      11h
dzhang-c01-encryption                     Opaque                                1      11h
dzhang-c01-etcd                           Opaque                                2      11h
dzhang-c01-extensions-ca                  kubernetes.io/tls                     3      11h
dzhang-c01-kubeconfig                     Opaque                                1      11h
dzhang-c01-metrics-server-cert            kubernetes.io/tls                     3      11h
dzhang-c01-proxy                          Opaque                                2      11h
dzhang-c01-pvcsi-token-f44cq              kubernetes.io/service-account-token   3      11h
dzhang-c01-sa                             Opaque                                2      11h
dzhang-c01-ssh                            kubernetes.io/ssh-auth                1      11h
**dzhang-c01-ssh-password                   Opaque                                1      11h**

Step 3: Get the password key from the secret.

root@photon-machine [ ~ ]#  k get secret dzhang-c01-ssh-password -o jsonpath={.data.ssh-passwordkey} | base64 --decode 
lvJwFqzwfhIlILrz/ZVVIh9cKKtMFNp5a8vlPjay44s=

Step 4: Connect to your nodes


root@photon-machine [ ~ ]#  ssh [email protected]
Welcome to Photon 3.0 (\\m) - Kernel \\r (\\l)
[email protected]'s password: 
Last login: Tue Nov 16 23:50:33 2021 from 192.168.2.106
 23:58:51 up 12:42,  0 users,  load average: 0.30, 0.42, 0.32
vmware-system-user@dzhang-c01-default-nodepool-7996g-6b9bf554-mxjmq [ ~ ]$ hostname
dzhang-c01-default-nodepool-7996g-6b9bf554-mxjmq
vmware-system-user@dzhang-c01-default-nodepool-7996g-6b9bf554-mxjmq [ ~ ]$

Thank you for your reading!