作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用RBAC来限制用户john
正常工作并仅在其命名空间test-namespace
中创建资源。
这是我所做的:
1)为用户生成证书并创建set-context
kubectl config set-credentials john --client-certificate=/home/john/.certs/employee.crt --client-key=/home/john/.certs/employee.key
kubectl config set-context john-context --cluster=minikube --namespace=test-namespace --user=john
test-namespace
中的部署。
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
namespace: test-namespace
name: deployment-authority
rules:
- apiGroups: ["", "extensions", "apps"]
resources: ["deployments", "replicasets", "pods"]
verbs: ["get", "create", "update", "patch", "delete"]
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: deployment-authority-binding-john
namespace: test-namespace
subjects:
- kind: User
name: john
apiGroup: ""
roleRef:
kind: Role
name: deployment-authority
apiGroup: ""
kubectl --context=john-context run --image busybox busybox
命令了,没有任何问题。
john-context
中运行允许其使用的命令。我无法将UNIX用户链接到Kubernetes用户。
john@kubernet:/$ id
uid=1002(john) gid=1002(john) groups=1002(john)
john@kubernet:/$ kubectl get po -n test-namespace
NAME READY STATUS RESTARTS AGE
grafana-67c6585fbd-tlr4n 1/1 Running 2 23h
test-namespace
中执行任何操作。
su - tom
tom@kubernet:/$ id
uid=1004(tom) gid=1004(tom) groups=1004(tom)
john@kubernet:/$ kubectl get po -n test-namespace
You are not allowed to view resources in this namespace
最佳答案
您可以通过用户主目录中的~/.kube/config
文件进行管理。用/home/john/.kube/config
说,您将得到以下内容:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0xxxxxxxxo=
server: https://172.1.1.1:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
namespace: default
user: john
name: john@kubernetes
current-context: john@kubernetes
kind: Config
preferences: {}
users:
- name: john
user:
client-certificate-data: LS0txxxxo=
client-key-data: LS0xxxxx==
600
权限。
关于kubernetes - 将Kubernetes用户链接到Unix用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52562445/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!