KUBERNETES-1-13-认证及Serviceaccount

本文档详细介绍了如何在Kubernetes中查看和管理Serviceaccount、证书以及配置文件。通过`kubectl`命令行工具,展示了查看API版本、用户认证信息、监听端口、名称空间、部署资源等操作,并演示了生成私钥、认证请求、公钥的过程。此外,还涉及到上下文设置、用户权限管理以及集群认证配置。
摘要由CSDN通过智能技术生成

1.kubectl api-versions查看kubectl的用户组。cat .kube/config查看配置信息,client-certificate-data可以看到用户的认证信息,client-key-data用户的密钥信息。

[root@master ~]# kubectl api-versions
admissionregistration.k8s.io/v1beta1
apiextensions.k8s.io/v1beta1
apiregistration.k8s.io/v1
apiregistration.k8s.io/v1beta1
apps/v1
apps/v1beta1
apps/v1beta2
authentication.k8s.io/v1
authentication.k8s.io/v1beta1
authorization.k8s.io/v1
authorization.k8s.io/v1beta1
autoscaling/v1
autoscaling/v2beta1
batch/v1
batch/v1beta1
certificates.k8s.io/v1beta1
events.k8s.io/v1beta1
extensions/v1beta1
networking.k8s.io/v1
policy/v1beta1
rbac.authorization.k8s.io/v1
rbac.authorization.k8s.io/v1beta1
scheduling.k8s.io/v1beta1
storage.k8s.io/v1
storage.k8s.io/v1beta1
v1
[root@master ~]# cat .kube/config 
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFNE1USXhNekUwTURRME5Gb1hEVEk0TVRJeE1ERTBNRFEwTkZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTXk2CjVTNTI5TWQwS0Jub3NVeGZaT2M1aWFEbHk0MDIzcjB3bjVwRnRlQlBvc2k0MktCejM1eWhjT3pLTm9CT3JWVkIKd2RvMFc3WUYrVXl3VWpyNGxlRFhiS25TWGxzSGdkQWE5cyt0NWVqSGFubW8vbFVPSkc2em1wa0wyN0NEdUpraQpOK3lVbjlrUUNKSDJ5ejlqM20wSExoenFtbGsxbmlzZ0JDSllPTzA4bDJXVm9Dc1huL2F0SGdtc0kxNmVodC9BCm0xTkNyYWVoei9wOXdEY21oTWxiMm43WitXaUwzQ3BrVTZtd29PdU9XS0ZVMzJ1d3ZsY3NCWDVwUEtLWDVOV3YKT29oY05udzJyUjVqTHdjTHIwSUkvYWpOTWd3MWptT0hnVnQ5TVZpN3R0dzJjZHRUZUwzbkRSWVlqMVE0NHBuWQpjUytIWXM0bFFDV0NvNmk0Y3VNQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFHMkZoSkZ4VDlrTkJodXB2ME9VZ3prMlhEaHMKU0o1bSs4M0NHWnplRnBZMHFNd3BCa3hXMUw3RklJczZjR2pFQlNrdGVXR2d6YmM0TFFaRm9oWHNReTNacUFMYwpvVDlDQ3ArK2FPZHRqeVdoL1lFK1pBRGFTNTA3SVRzcmt4WUt2NXd0SGV1a0pUUnYxdS8rdm5MZ0tGaldCUXErCncxZHhYUGZjdDZjejNobWV3ME5Xd2gva21hSUJ0aUwzdXFuVmZyZG1QN0ZOd0ZSd2ZkYlNmTGhxUzh2aStsdDUKV3RHOEE2VjdjeG9SaGJJL0NHb3VWMWUyaGp2TnZUYWdldlVFUkJXTlVRTjRKeG9Gby8xcjJBY0lMZmtBR2k5OAo3di94WWhWaGcwcG5XRWIrcGlaSTRHV3hKd29PbjY2UUxQVnZEZVRUcitlSzIwcXdMekVTd1oyUmtaST0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
    server: https://172.20.0.128:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-adm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ApHc0tyL1cwcnR2YWhTaFR1d09YU2lWZjJxdWhQNVJkdERpd2Z1b1BTQmxTOTNtcWNhVlVhd2tua1RBaU9ab2ppCkhRdkFRWDBySlVPcUNieExBUmptUEpQUERVbmJ1aFdiT09HTkN0ZXFYOUZoNVdrMjRjUys0bmpqd1g1Ui9SNHYKVEhKK1F5bjQ0Nm5OWDVNQ01kaCtuQ

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值