1 找一个token

kubectl get secret kube-proxy-token-qvcp2  -n kube-system -o jsonpath={".data.token"} | base64 -d
eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJlLXByb3h5LXRva2VuLXF2Y3AyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmUtcHJveHkiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI5MmQxY2FlZC1hYjE2LTExZWEtYTUxNy01MjU0MmMzNDgzOGYiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZS1wcm94eSJ9.Z3GPxRHkp8wuIkGDf8DcOM-ZpunXtifhI6Wcd92lghOjrAOU7b2yIe6M2ybT22GuWANKezbe85DPqxvkIhTOhaVNkfeOuyhbBs5FBi3wBcjGVH2QAge1bHNT2yL_gjhaFR-tuaJSwrZpYWV8ubYXEB3ydNRpDh7CrdGcB8uBbkZgtsvWlBdWqSG-w5qcsJCcUmA-dP8ClW24pXCXVtzQ5VspbUJNS2OI3CR1PWROZCKBshifdyxkpPZXDrpRpPUrRRaVeG5f3v-DOhl_zI3T604ThqDvr9pJHSG7UIioUF-F9AmJtHMX0SAZyrZV-e8cnskakk_vcrAZd1AEqQjfSA

2 访问测试

curl -k -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJlLXByb3h5LXRva2VuLXF2Y3AyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmUtcHJveHkiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI5MmQxY2FlZC1hYjE2LTExZWEtYTUxNy01MjU0MmMzNDgzOGYiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZS1wcm94eSJ9.Z3GPxRHkp8wuIkGDf8DcOM-ZpunXtifhI6Wcd92lghOjrAOU7b2yIe6M2ybT22GuWANKezbe85DPqxvkIhTOhaVNkfeOuyhbBs5FBi3wBcjGVH2QAge1bHNT2yL_gjhaFR-tuaJSwrZpYWV8ubYXEB3ydNRpDh7CrdGcB8uBbkZgtsvWlBdWqSG-w5qcsJCcUmA-dP8ClW24pXCXVtzQ5VspbUJNS2OI3CR1PWROZCKBshifdyxkpPZXDrpRpPUrRRaVeG5f3v-DOhl_zI3T604ThqDvr9pJHSG7UIioUF-F9AmJtHMX0SAZyrZV-e8cnskakk_vcrAZd1AEqQjfSA' https://172.16.99.200:6443/api

3 查看输出

{
  "kind": "APIVersions",
  "versions": [
    "v1"
  ],
  "serverAddressByClientCIDRs": [
    {
      "clientCIDR": "0.0.0.0/0",
      "serverAddress": "172.16.99.200:6443"
    }
  ]
}
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐