Search code examples
windowskubernetesopenid-connectkubectl

kubectl config set-credentials --auth-provider: Error: Unknown flag: --auth-provider


I've installed kubectl (version 1.16.0) on Windows 10, and the command works fine.

However, when tryin to run kubectl config set-credentials <some_param> --auth-provider=oidc, I get the following error: Error: unknown flag: --auth-provider.

This happens even though when I run kubectl config set-credentials -h I can see the --auth-provider as a possible option..

How can it be fixed?


Solution

  • If you want to use the kubectl oidc authenticator during authentication process, which sets the id_token as a bearer token for all requests and refreshes the token once it expires. After you’ve logged into your provider, use kubectl to add your id_token, refresh_token, client_id, and client_secret to configure the plugin.

    Proper configuration of command kubectl config set-credentials is that:

    First you have to define user name for whom credentials will be created. Then you can pass additional parameters (enable oidc as auth-provider and add arguments to it). This is how proper syntax of kubectl config set-credentials command should look like:

       $ kubectl config set-credentials USER_NAME \
           --auth-provider=oidc \
           --auth-provider-arg=idp-issuer-url=( issuer url ) \
           --auth-provider-arg=client-id=( your client id ) \
           --auth-provider-arg=client-secret=( your client secret ) \
           --auth-provider-arg=refresh-token=( your refresh token ) \
           --auth-provider-arg=idp-certificate-authority=( path to your ca certificate ) \
           --auth-provider-arg=id-token=( your id_token )
    

    More information about authentication you can find here: kubernetes-authentication.