Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何创建只访问kubernetes中特定命名空间的linux系统帐户?_Kubernetes - Fatal编程技术网

如何创建只访问kubernetes中特定命名空间的linux系统帐户?

如何创建只访问kubernetes中特定命名空间的linux系统帐户?,kubernetes,Kubernetes,在我的Linux服务器上,我有kubernetes集群。许多开发人员使用这个集群。 我想为只能访问特定kubernetes命名空间的用户创建Linux系统帐户 在主机中创建linux帐户 为帐户创建TLS证书 创建kubeconfig以使用TLS认证连接到apiserver。比如: 使用RBAC为用户提供适当的权限,如命名空间的完全权限: openssl genrsa -out ${account-name}-key.pem 2048 openssl req -new -sha256 -ke

在我的Linux服务器上,我有kubernetes集群。许多开发人员使用这个集群。 我想为只能访问特定kubernetes命名空间的用户创建Linux系统帐户

  • 在主机中创建linux帐户
  • 为帐户创建TLS证书
  • 创建kubeconfig以使用TLS认证连接到apiserver。比如:
  • 使用RBAC为用户提供适当的权限,如命名空间的完全权限:

  • openssl genrsa -out ${account-name}-key.pem 2048 
    openssl req -new -sha256 -key ${account-name}-key.pem -out ${account-name}.csr -subj "/CN=${account-name}"
    openssl x509 -req -sha256 -in ${account-name}.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out ${account-name}.pem -days 365
    
    apiVersion: v1
    kind: Config
    clusters:
    - cluster:
        certificate-authority: /home/account-name/ssl/ca.pem
        server: https://master-ip
      name: k8s
    contexts:
    - context:
        cluster: k8s
        user: account-name
      name: admin
    current-context: admin
    users:
    - name: account-name
      user:
        client-certificate: /home/account-name/ssl/account-name.pem
        client-key: /home/account-name/ssl/account-name-key.pem
    
    apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: RoleBinding
    metadata:
      name: account-name-admin
      namespace: namespace-name
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: edit
    subjects:
    - apiGroup: rbac.authorization.k8s.io
      kind: User
      name: account-name