Reputation: 71
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: [email protected]
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: admin-role
Below is the part of the configuration that i have added.
users:
- name: [email protected]
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
Upvotes: 0
Views: 291
Reputation: 71
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.
Upvotes: 1