Configure Kaptain to use the Dex OIDC Provider on a Kommander management cluster for authentication.
Prerequisites
- A Kommander management cluster.
- A managed cluster, into which Kaptain will be installed.
- The managed cluster is attached to the management cluster (Kommander). (You will need to create a cluster via Kommander to have a managed Konvoy cluster.)
- A Dex Client created on the management cluster.
Kaptain configuration requirements
To use the Kommander Dex instance for authentication with Kaptain you will need to collect the following information:
- External OIDC provider endpoint from the management cluster
- External OIDC provider CA bundle (if necessary)
Create a Dex Client
To create the external Dex Client ID, run the following commands on the (Kommander) management cluster:
Create the Dex Client, noting the client id kaptain-authservice
for later use.
cat <<EOF | kubectl apply -f -
apiVersion: dex.mesosphere.io/v1alpha1
kind: Client
metadata:
name: kaptain-authservice
namespace: kommander
spec:
displayName: Kaptain Auth Service
clientSecretRef:
name: kaptain-authservice-client-secret
EOF
Create a Dex Client Secret
Generate a client secret, noting it for later use:
Example:
KAPTAIN_SECRET=$(openssl rand -hex 32)
To create a Dex client secret, run the following command on the (Kommander) management cluster:
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: kaptain-authservice-client-secret
namespace: kommander
type: Opaque
stringData:
client-secret: ${KAPTAIN_SECRET}
EOF
Get external OIDC provider endpoint and CA bundle
Get the management cluster’s OIDC provider endpoint as https://<management-cluster-url>/dex
(Optional) In case a custom CA is provided for Kommander certificate, to get the OIDC provider CA bundle, run the following command on the (Kommander) management cluster:
kubectl get secret kommander-traefik-certificate -n kommander -o jsonpath='{.data.ca\.crt}'
Install Kaptain
Create or update the ConfigMap with Kaptain’s configuration and include the following properties:
ingress:
externalDexClientId: dex-controller-kaptain-authservice
externalDexClientSecret: <Dex Client secret, stored as KAPTAIN_SECRET>
oidcProviderEndpoint: <OIDC provider endpoint>
oidcProviderBase64CaBundle: <OIDC provider CA bundle, optional>
The resulting configuration file should look similar to the following:
ingress:
externalDexClientId: dex-controller-kaptain-authservice
externalDexClientSecret: e4289349e99d5814e63c602373bc9520ac225a810c695d5d80a6cefe42fa939f
oidcProviderEndp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TGJmSVdmYkJ4VzFDd0UxdEhuaTFPd3pROGkzUytpUFhuQ0dCZFNSdm5FQkJsCnF1bkpqdWRBMm9odEs5SmViTUhPTEFpbXRnWVhZdVllTFZudGxpWCtQdmxRMWxoYzByeXFENkRkWUUwckJSdlcKRkgvSTY2b2ZONGZFVlJ2RjFiSG5uZ1BsZlFUcHNRRzZFZVNoa0RvclAwSDhxNnU5RXcyaG5Ba0hwRXVlWUJibQpkeXZvRStVWTM1ck9XK3pEQ3NXNUNPRTVGWjVWQ64lRmJMRmRSUU9tdW9BaXlCV2UyTHZHdjgzdXVSZTRsSWhxCnAxSEIrZlBPTGdJVGRaSHEwYkgvdEZZNEw0YmNkRGhGYnlJRldzN01NZ2FxeCtMZThoMDNIZE5ybG5USQotLS0tWARORCBDRVJUSUZJQ0FURS0tRS0tCg==
See Install Kaptain for more info. To install Kaptain through the Kommander UI, copy and paste the configuration values from the previous section into the Kommander UI and deploy the Kaptain application.
Add the redirect URL to Kaptain authentication service in the management cluster
Once Kaptain is up, get the redirect URL from Kaptain’s authentication service by running the following command on the managed cluster:
kubectl exec -it -n kaptain-ingress authservice-0 -- sh -c 'echo $REDIRECT_URL'
On the management cluster, add the Redirect URL to the redirectURLs
list of the Dex Client’s resource:
kubectl patch client kaptain-authservice -n kommander --type merge -p '{"spec": {"redirectURIs": ["<Redirect URL>"]}}'
Log in to Kaptain using the management cluster’s Dex instance
Refer to the Kaptain login section to access Kaptains’s Kubeflow dashboard.