Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf4f88a

Browse files
author
Nándor István Krácser
authored
Merge pull request dexidp#1648 from int128/patch-1
Update kubelogin-activedirectory.md for credential plugin mode
2 parents 0014ca3 + 2ec5e54 commit cf4f88a

1 file changed

Lines changed: 24 additions & 20 deletions

File tree

Documentation/connectors/kubelogin-activedirectory.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,35 +95,39 @@ Then restart API server(s).
9595

9696
See https://kubernetes.io/docs/reference/access-authn-authz/authentication/ for more detail.
9797

98-
### kubelogin
98+
### Set up kubeconfig
9999

100-
Create context for dex authentication:
100+
Add a new user to the kubeconfig for dex authentication:
101101

102102
```console
103-
$ kubectl config set-context oidc-ctx --cluster=cluster.local --user=test
104-
$ kubectl config set-credentials test \
105-
--auth-provider=oidc \
106-
--auth-provider-arg=idp-issuer-url=https://dex.example.com:32000/dex \
107-
--auth-provider-arg=client-id=kubernetes \
108-
--auth-provider-arg=client-secret=ZXhhbXBsZS1hcHAtc2VjcmV0 \
109-
--auth-provider-arg=idp-certificate-authority-data=$(base64 -w 0 openid-ca.pem) \
110-
--auth-provider-arg=extra-scopes="offline_access openid profile email groups"
111-
$ kubectl config use-context oidc-ctx
103+
$ kubectl config set-credentials oidc \
104+
--exec-api-version=client.authentication.k8s.io/v1beta1 \
105+
--exec-command=kubectl \
106+
--exec-arg=oidc-login \
107+
--exec-arg=get-token \
108+
--exec-arg=--oidc-issuer-url=https://dex.example.com:32000/dex \
109+
--exec-arg=--oidc-client-id=kubernetes \
110+
--exec-arg=--oidc-client-secret=ZXhhbXBsZS1hcHAtc2VjcmV0 \
111+
--exec-arg=--extra-scope=profile \
112+
--exec-arg=--extra-scope=email \
113+
--exec-arg=--extra-scope=groups \
114+
--exec-arg=--certificate-authority-data=$(base64 -w 0 openid-ca.pem)
112115
```
113116

114-
Please confirm idp-issuer-url, client-id, client-secret and idp-certificate-authority-data value is same as config-ad-kubelogin.yaml's value.
117+
Please confirm `--oidc-issuer-url`, `--oidc-client-id`, `--oidc-client-secret` and `--certificate-authority-data` are same as values in config-ad-kubelogin.yaml.
115118

116-
Then run kubelogin:
119+
Run the following command:
117120

118121
```console
119-
$ kubelogin
122+
$ kubectl --user=oidc cluster-info
120123
```
121124

122-
Access http://localhost:8000 by web browser and login with your AD account (eg. [email protected]) and password.
123-
After login and grant, you have following token in ~/.kube/config:
125+
It launches the browser and navigates it to http://localhost:8000.
126+
Please log in with your AD account (eg. [email protected]) and password.
127+
After login and grant, you can access the cluster.
124128

125-
```
126-
id-token: eyJhbGciOiJSUzICuU4dCcilDDWlw2lfr8mg...
127-
refresh-token: ChlxY2EzeGhKEB4492EzecdKJOElECK...
128-
```
129+
You can switch the current context to dex authentication.
129130

131+
```console
132+
$ kubectl config set-context --current --user=oidc
133+
```

0 commit comments

Comments
 (0)