简体   繁体   中英

Configure kubernetes cluster to use OpenID Connect Authentication

Configured my kubernetes cluster to use OpenID Connect Authentication. i'm getting the error as "error: You must be logged in to the server (Unauthorized)". I have

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: admin-role
rules:
- apiGroups: ["*"]
  resources: ["*"]
  verbs: ["*"]

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: admin-binding
subjects:
- kind: User
  name: krishnavamsi@gmail.com
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: admin-role

Below is the part of the configuration that i have added.

users:
- name: krishnavamsi@gmail.com
  user:
    auth-provider:
      config:
        client-id: XXXXXX
        client-secret: YYYYYYYYYY
        id-token: ZZZZZZZZZZZZZZ
        idp-issuer-url: https://accounts.google.com
        refresh-token: PPPPPPPPPPPPP
      name:oidc

I now got the issue resolved. This step was missing.

sed -i "/- kube-apiserver/a\ - --oidc-issuer-url=https://accounts.google.com\n - --oidc-username-claim=email\n - --oidc-client-id=[YOUR_GOOGLE_CLIENT_ID]" /etc/kubernetes/manifests/kube-apiserver.yaml on master before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM