Authenticating to Github can be done either by using "device authentication flow" or using a service user.

Using device authentication flow

Okctl's default method for authenticating with Github, is using the device authentication flow.

At the beginning of the cluster creation process, Okctl will ask you to enter a code in a browser window. The code will be presented. Copy it and press Y and enter. Okctl will open a window in your browser where you can enter the code.

Copy the code highlighted in green and press Y and then enter :

Paste it to the newly opened tab in your browser:

Press the green "Authorize oslokommune" button:

That's it! You are all set. Switch back to the console and enjoy Okctl creating your cluster for you.

Using a service user

In some cases, it can be useful to use a service user for authentication.

By passing the flag --github-credentials-type token to okctl apply cluster, Okctl will look for the following environment variable to be used to authenticate:

  • GITHUB_TOKEN
# Example
export GITHUB_TOKEN=mytoken

okctl apply cluster --github-credentials-type token -f cluster.yaml

Set the following environment variable to avoid having to specify the credentials type on each command:

export OKCTL_GITHUB_CREDENTIALS_TYPE=token