第一种方式:
kubectl -n kubesphere-system get sa kubesphere -oyaml
apiVersion: v1
kind: ServiceAccount
metadata:annotations:meta.helm.sh/release-name: ks-coremeta.helm.sh/release-namespace: kubesphere-systemcreationTimestamp: "2023-07-24T07:42:22Z"labels:app.kubernetes.io/instance: ks-coreapp.kubernetes.io/managed-by: Helmapp.kubernetes.io/name: ks-coreapp.kubernetes.io/version: v3.1.0helm.sh/chart: ks-core-0.1.0name: kubespherenamespace: kubesphere-systemresourceVersion: "6605"selfLink: /api/v1/namespaces/kubesphere-system/serviceaccounts/kubesphereuid: 87471ddc-3d88-4baf-b05b-e86dee6dc9db
secrets:
- name: kubesphere-token-fcjqp# 查看secret
kubectl -n kubesphere-system describe secret kubesphere-token-fcjqp
Name: kubesphere-token-fcjqp
Namespace: kubesphere-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: kubespherekubernetes.io/service-account.uid: 87471ddc-3d88-4baf-b05b-e86dee6dc9dbType: kubernetes.io/service-account-tokenData
====
namespace: 17 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6InBqVE40Q2JqblR0cWkzeXF4Ui1ZbVdXS0tTT1JpSmlaM09CRVlNci1pcWsifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlc3BoZXJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJlc3BoZXJlLXRva2VuLWZjanFwIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmVzcGhlcmUiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI4NzQ3MWRkYy0zZDg4LTRiYWYtYjA1Yi1lODZkZWU2ZGM5ZGIiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXNwaGVyZS1zeXN0ZW06a3ViZXNwaGVyZSJ9.R2mlbE_gg_9SFQl6K6zb3L99vOgM8E7fHmPlLzl2sq94w3a4nIkZ3KKXaxKxFmygXQJhsdojtWavsTxjBIwa0LFtDe6ms4EyGZxBxw0vaMdZqPww-XvR1v5Ckt5W9z8ZPL93pFw4iNU22ipifBV8FXJ95p2bGKKUuOkiOxsMyyKJqdB0KOmzCvTGo8WDg63CMzNV8YPvUscqPVgZPHNLAzs49Sd6rBxvWZq4MutJ1zlrX0Wr26Aa3s39XpYxGZnUuehOCAiMFINLRkyIjbplvPCCX_ZdEpM23qVIonU0NqvTU_xdQ9iCkpocCterREslA8Zaxak385fw1o6g2C559w
ca.crt: 1066 bytes
就用这个token,在postman的api集合中建立一个认证配置,集合下的都可以使用了
postman去掉SSL证书验证
添加请求时,认证选择继承父