k8s令牌登录设置方法


apiVersion: v1 kind: ServiceAccount metadata: name: admin
-aook namespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: admin-aook roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: admin-aooknamespace: kube-system

上面是样例 请自行设置参考名称

这个文件放置的文件目录下执行以下命令

kubectl create -f admin.yaml

  

运行以下命令拿到json字符串进行编码

 kubectl get secret admin-hexiaoqiang-token-5dzcl -n kube-system -o json

 

 输出进行解密 自己拿自己的token值进行操作 别用这儿的

echo ZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklpSjkuZXlKcGMzTWlPaUpyZFdKbGNtNWxkR1Z6TDNObGNuWnBZMlZoWTJOdmRXNTBJaXdpYTNWaVpYSnVaWFJsY3k1cGJ5OXpaWEoyYVdObFlXTmpiM1Z1ZEM5dVlXMWxjM0JoWTJVaU9pSnJkV0psTFhONWMzUmxiU0lzSW10MVltVnlibVYwWlhNdWFXOHZjMlZ5ZG1salpXRmpZMjkxYm5RdmMyVmpjbVYwTG01aGJXVWlPaUpoWkcxcGJpMW9aWGhwWVc5eGFXRnVaeTEwYjJ0bGJpMDFaSHBqYkNJc0ltdDFZbVZ5Ym1WMFpYTXVhVzh2YzJWeWRtbGpaV0ZqWTI5MWJuUXZjMlZ5ZG1salpTMWhZMk52ZFc1MExtNWhiV1VpT2lKaFpHMXBiaTFvWlhocFlXOXhhV0Z1WnlJc0ltdDFZbVZ5Ym1WMFpYTXVhVzh2YzJWeWRtbGpaV0ZqWTI5MWJuUXZjMlZ5ZG1salpTMWhZMk52ZFc1MExuVnBaQ0k2SWprME1XWXhaV0ZsTFRaak1UVXRNVEZsT1MwNVpEYzFMVEF3TUdNeU9UZGhaRFkxTlNJc0luTjFZaUk2SW5ONWMzUmxiVHB6WlhKMmFXTmxZV05qYjNWdWREcHJkV0psTFhONWMzUmxiVHBoWkcxcGJpMW9aWGhwWVc5eGFXRnVaeUo5LkxhQlk3YVFOZVhTQXh0NW5YTU5aemtNYzNmejdtTS1wUGJvZHVhNXgyMGtXdy02YjdQRnBtMEZIVUFIdW9EUUJ2NUs4eVNDM1ZkVTdQcEtSNWE4ajRFcmw4SWZSVHJGdDhJTWllbDY5SFV4TGpmeXBaT3pVa29HVXFOZlRTdXhoNDNnSldDeDhLNUdJYVQ0eXp6a01FM3dqVmNuZWUxMEhUWnNZYjI2YzVnbWhVSXB1ZGdTb01WakdXSmJONUtFWEJodWZBLThaZ3E5OHhFbmJVeWlEQ0Z5YkV2SVB5aGJkOVJXa1JVeFU4VEIxbmlEdnZlRUZiOUg1SzNGX3RSQzNvS2NGOWVxaDZHYm9WejJwYmR6amJsd1dtNGozbWxaMXlnZlQ0UlFnaDJ2MklwdXBtaFA2V3dyX2hpak1aeVotRmJHVjdnTVNJUlQxX1ZqYkp4d0txdnBQdDdLTzk1WUtFSlh0bGpOdERqcXk2OTNxeHluVTBBMlVZb0ltOGZSRTc3YnpjRUYwaS1OOXJLbC1ZeE56aTRkX3B4SjVaWVVrbXNjbEtpTmNrNFdmeTNGdzRGRmUxcGdXczVyd0FGM3dDSklEZkJHTG1udFBiVVNrdDhxdHNEajBYLWxmMUJzWHpUM3hlOE1jNF9wUlhpMXdRdUNQU01GUlRqVlpnTm1v | base64 -d

 

复制这些进行登录使用

windows使用火狐浏览器登录

查看集群端口

kubectl get svc -o wide -n kube-system

 

把刚才拿到的token值粘贴到以下位置


点击登录ok

posted @ 2019-05-04 12:08  超我  阅读(3362)  评论(0编辑  收藏  举报