opx命名空间下的pods
[root@master-63 test]# kubectl get pods -n opx
NAME READY STATUS RESTARTS AGE
http-v1-7675d88556-swt2h 2/2 Running 0 7d
http-v2-5f7dc58847-t8c26 2/2 Running 0 7d
test-7c8dc594d-hjslk 2/2 Running 2 23d
创建一个用户指定opx命名空间(注意–namespace=opx是你要登录访问的命名空间)
[root@master-63 test]# kubectl create rolebinding opx-ns-admin --clusterrole=admin --serviceaccount=opx:opx-ns-admin --namespace=opx
rolebinding.rbac.authorization.k8s.io/opx-ns-admin created
查看命名空间下的secrets
[root@master-63 test]# kubectl get secrets -n opx
NAME TYPE DATA AGE
default-token-2kcrt kubernetes.io/service-account-token 3 23d
opx-ns-admin-token-vhd5g kubernetes.io/service-account-token 3 2m9s
查看token
[root@master-63 test]# kubectl -n opx describe secrets opx-ns-admin-token-dvf8r
Name: opx-ns-admin-token-dvf8r
Namespace: opx
Labels: <none>
Annotations: kubernetes.io/service-account.name: opx-ns-admin
kubernetes.io/service-account.uid: e0316cb4-eeed-4dec-8d73-0c2d1d2aa8d0
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1025 bytes
namespace: 3 bytes
你的登录>>token: eyJhbGciOiJSUzI1NiIsImtpZCI6IlJ6VEtZdy1RdnlTZVRTMU9ieFB3cWNVMy1YNXFEVWRXdXE3Z0JxRXQtaHcifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJvcHgiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlY3JldC5uYW1lIjoib3B4LW5zLWFkbWluLXRva2VuLWR2ZjhyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Im9weC1ucy1hZG1pbiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImUwMzE2Y2I0LWVlZWQtNGRlYy04ZDczLTBjMmQxZDJhYThkMCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpvcHg6b3B4LW5zLWFkbWluIn0.bZrgbNoUDMYkM1K2HIKGFXcuhOHYtkZona42A3T-FM8De5PGhRdPPA2PPSgTSTI0lscoYHEflAA0E5IiPEAtyFyTxttqP4bDToz52J6CfCb43n0rd4MdyLB7VMbNNwY83K3YhhT205I1eaSoVwKrW1A7hjPXPQR42e6rthwViyI-5NGiau7DQigNpZUuduWhed-T-o9BaXUE-_vcr8PAln1LuO1K667cUwh7juaah0z4jfRRUOCJ0QDvNluGfbuHb4j-QJNzG3WTe43ByaTItTLN0FIObjtaDgvxi8TE2fcmDR1h7rTnfCzlf1ZWG4D6Dr9itlEUOOg-cp3BTSJHXQ
最好登录你的kubernetes-dashboard