Talos
Sign in to Kubernetes on Talos Linux with Pocket ID.
Talos is a lightweight, API-driven, full-stack Kubernetes system. As with any Kubernetes server, you can set it up to authenticate users with OIDC. This guide configures Talos to use Pocket ID as the authentication and authorization server.
Create the client in Pocket ID
Section titled “Create the client in Pocket ID”- In Pocket ID, open Administration → OIDC Clients and click Add OIDC Client.
- Enter a name such as
Talosand add the callback URLhttp://localhost:8000. - Click Create and copy the Client ID and the Client secret. The client secret is only shown once.
- On the client’s Access tab, select the groups that may sign in under Allowed User Groups, or choose All Users.
Configure Talos
Section titled “Configure Talos”Modify the cluster.apiServer block to include the following:
cluster: apiServer: image: registry.k8s.io/kube-apiserver:v1.33.1 # The container image used in the API server manifest. extraArgs: oidc-issuer-url: https://id.example.com oidc-client-id: <client-id> oidc-username-claim: sub oidc-groups-claim: groups oidc-groups-prefix: "oidc:"Create a cluster role binding that links the admin group you want to use to Kubernetes.
In the following example, there is a group called kubernetes in Pocket ID that the user is assigned to.
# filename=crb.yamlapiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata: name: cluster-admins-from-pass-keysroleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-adminsubjects: - apiGroup: rbac.authorization.k8s.io kind: Group name: oidc:kubernetesApply it:
kubectl apply -f crb.yamlModify the kubeconfig file
Section titled “Modify the kubeconfig file”Install the command line tool kubelogin. Refer to its GitHub repository for instructions for your system.
Run the following command to generate a config and validate that the token works:
kubectl oidc-login setup \--oidc-issuer-url=https://id.example.com \--oidc-client-id=<client-id> \--oidc-client-secret=<client-secret> \--oidc-extra-scope=groups,email,name,sub,email_verifiedMake sure that your email is verified, as Kubernetes requires this when working with OIDC.
You should get a response similar to this:
{ "aud": "a60960a8-c856-43b7-add7-50d83bf7eeab", "email_verified": true, "exp": 1749867571, "groups": ["kubernetes"], "iat": 1749863971, "iss": "https://id.example.com", "nonce": "sLY0SUaiLxe9JDfUpNEsBDbhKceOB-T1zxxRYJPQbvk", "sub": "643c3fba-370a-4738-92a6-9ergec96cd99"}Create a new user in your ~/.kube/config file:
- name: pocket-id user: exec: apiVersion: client.authentication.k8s.io/v1beta1 args: - oidc-login - get-token - --oidc-issuer-url=<pocket ID url> - --oidc-client-id=<pocket ID url> - --oidc-client-secret=<pocket ID url> - --oidc-extra-scope=groups - --oidc-extra-scope=email - --oidc-extra-scope=nameThen update your current context to use this user:
- context: cluster: testing namespace: default user: admin@testng user: pocket-id name: testing