Skip to content

Instantly share code, notes, and snippets.

@abarrak
Created February 9, 2022 12:32
Show Gist options
  • Save abarrak/84752c698fa27403a2293026860f7b04 to your computer and use it in GitHub Desktop.
Save abarrak/84752c698fa27403a2293026860f7b04 to your computer and use it in GitHub Desktop.
A .kube config file for auto authentication to Kubernetes Cluster using OIDC
apiVersion: v1
clusters:
- cluster:
server: https://my-cluster.net
name: cluster-net
contexts:
- context:
cluster: my-cluster.net
user: oidc
name: cluster-user
current-context: cluster-user
kind: Config
preferences: {}
users:
- name: oidc
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- get-token
- --oidc-issuer-url=<oidc-issuer-url>/auth/realms/<REALM>
- --oidc-client-id=kube-apiserver
- --oidc-client-secret=<OIDC-CLIENT-SECRET>
command: kubelogin
env: null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment