serviceAccount 获取 Token 以及权限的方式
手动获取Token 并发送请求给容器接口。
/var/run/secrets/kubernetes.io/serviceaccount $ pwd
/var/run/secrets/kubernetes.io/serviceaccount $ cat ./token
eyJhbGciOiJSUzI1NiIsImtpZCI6ImE3N2JhOGMwY2FjYWEwNDk0MWU4MWM0ODk1Y2JiZjBiOTU2NTA1OTYifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjIl0sImV4cCI6MTcyMTk3ODkxOCwiaWF0IjoxNjkwNDQyOTE4LCJpc3MiOiJodHRwczovL29pZGMuZWtzLmNuLW5vcnRoLTEuYW1hem9uYXdzLmNvbS5jbi9pZC9DMEE5NzJGNERCMThBOTMxN0RBMzk0Q0MwRDMzMjU3RiIsImt1YmVybmV0ZXMuaW8iOnsibmFtZXNwYWNlIjoibW9uaXRvcmluZyIsInBvZCI6eyJuYW1lIjoicHJvbWV0aGV1cy1rOHMtMCIsInVpZCI6ImE4YzdkMGY2LWUyMmEtNGY2Ny04NzYzLWNiNGQwYzM5MWFlMCJ9LCJzZXJ2aWNlYWNjb3VudCI6eyJuYW1lIjoicHJvbWV0aGV1cy1rOHMiLCJ1aWQiOiJmN2M3YWMzZC1iZmY4LTRmODctYTlkNy04MjJjYWM4ZDVjMjkifSwid2FybmFmdGVyIjoxNjkwNDQ2NTI1fSwibmJmIjoxNjkwNDQyOTE4LCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6bW9uaXRvcmluZzpwcm9tZXRoZXVzLWs4cyJ9.D3a7b93ZnBrmM-hjFrklce8upr8gUhUYYwmjGzZKOKb4EWUCoQXY1p197UoViUmYzbiOhchbehKosFcOjiL2GVGXqDRIXPmFU9p8l80Z9fuilB2TmexB6uBavuEF6blKHkH0VjyVQ3Kg39WzjD0Atrw-G6N4QZ_m0TOcKFfqRPebbH-Q-vzz5UuNPUYRKF4XZIT84QqYLYiBOkkeFIS_abo18YddMbn2AZQcbWamxQV2XPXjNKKw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xQV2XPXjNKKwHeQvP1Xdr4hZLt0oGudE2XZtQp60ZCrfDmQteh-KhMWRvsZpoNvE4n8HieAhTTrFq_TjjX9IHlXrPmcONAkQ33jVgRIaw_r_0g"
curl -k -H "$TOKEN" https://127.0.0.1:10250/metrics
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Liarlee's Notebook!