|
| 1 | ++++ |
| 2 | +title = "Authentication using OIDC" |
| 3 | +description = "Authentication and authorization support through OIDC for Kubeflow in AWS" |
| 4 | +weight = 90 |
| 5 | ++++ |
| 6 | + |
| 7 | +This section shows the how to setup Kubeflow with authentication and authorization support through OIDC in Amazon Web Services (AWS). Similar to [Cognito tutorial](https://www.kubeflow.org/docs/aws/authentication/). |
| 8 | + |
| 9 | +## Enable TLS and Authentication |
| 10 | + |
| 11 | +Right now, certificates for ALB public DNS names are not supported. Instead, you must prepare a custom domain. You can register your domain in Route53 or any domain provider such as [GoDaddy.com](https://www.godaddy.com/). |
| 12 | + |
| 13 | +[AWS Certificate Manager](https://aws.amazon.com/certificate-manager/) is a service that lets you easily provision, manage, and deploy public and private Secure Sockets Layer/Transport Layer Security (SSL/TLS) certificates for use with AWS services and your internal connected resources. |
| 14 | + |
| 15 | +To get TLS support from the ALB Ingress Controller, you need to follow [this tutorial](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html) to request a certificate in AWS Certificate Manager. After successful validation, you will get a `certificate ARN` to use with the ALB Ingress Controller. |
| 16 | + |
| 17 | +> Note: Even you need to create a `certificate ARN`, we don't necessarily need a custom domain unless you want to use it, you can still use ALB ingress hostname to visit kubeflow central dashboard. |
| 18 | +
|
| 19 | +<img src="/docs/images/aws/cognito-certarn.png" |
| 20 | + alt="Cognito Certificate ARN" |
| 21 | + class="mt-3 mb-3 border border-info rounded"> |
| 22 | + |
| 23 | +[OIDC](https://openid.net/connect/) allows clients to verify the identity of the End-User based on the authentication performed by an Authorization Server. OIDC allows clients of all types, including Web-based, mobile, and JavaScript clients, to request and receive information about authenticated sessions and end-users. You can use any OIDC compatible solutions including Google, Facebook and Github for authentication. For this tutorial, we take Github Login as an example. |
| 24 | + |
| 25 | +In order to authenticate and manage users for Kubeflow, let's first connect Auth0 app to Github. You can follow instructions [here](https://auth0.com/docs/connections/social/github) or follow below detailed steps: |
| 26 | + |
| 27 | +### 1. Register Your New App on Auth0 |
| 28 | +You should go to the [Auth0 page](https://manage.auth0.com/) to sign up and login at first. |
| 29 | + |
| 30 | +<img src="/docs/images/aws/auth0-login.png" |
| 31 | + alt="Auth0 Login" |
| 32 | + class="mt-3 mb-3 border border-info rounded"> |
| 33 | + |
| 34 | +Then you can look at below page and modify the domain name Under `TENANT DOMAIN` to be your preferable domain name and take notes. |
| 35 | + |
| 36 | +<img src="/docs/images/aws/auth0-welcome-page.png" |
| 37 | + alt="Auth0 Welcome Page" |
| 38 | + class="mt-3 mb-3 border border-info rounded"> |
| 39 | + |
| 40 | +After modification, click **NEXT** button. Then you can set up your personal information there and click **CREATE ACCOUNT** button. |
| 41 | + |
| 42 | +### 2. Add a new Application in Github |
| 43 | +To add a new application, log in to [GitHub](https://github.com/) and go to **OAuth Apps** in your [developer settings](https://github.com/settings/developers). Next click [Register a new application](https://github.com/settings/applications/new). |
| 44 | + |
| 45 | +<img src="/docs/images/aws/github-oauth-app-register.png" |
| 46 | + alt="Github Oauth App Register" |
| 47 | + class="mt-3 mb-3 border border-info rounded"> |
| 48 | + |
| 49 | +### 3. Register Your New App on Github |
| 50 | +On the [Register a new application](https://github.com/settings/applications/new) page fill out the form with the following information. Modify the parameters to reflect your application. |
| 51 | + |
| 52 | +In step 1, you registered new app on Auth0 and there's a `TENANT DOMAIN`. Now it is your Github Homepage URL with prefix of `https://`. For example, if your Auth0 tenant domain was `kftest.auth0.com`, your Github Homepage URL would be `https://kftest.auth0.com` and your redirect URL would be `https://kftest.auth0.com/login/callback`. |
| 53 | + |
| 54 | +<img src="/docs/images/aws/github-oauth-app-register-details.png" |
| 55 | + alt="Github Oauth App Register Details" |
| 56 | + class="mt-3 mb-3 border border-info rounded"> |
| 57 | + |
| 58 | +After completing the form click **Register application** to proceed. |
| 59 | + |
| 60 | +### 4. Configure Github and Auth0 app |
| 61 | +Once the application is registered, your app's `Client ID` and `Client Secret` will be displayed on the following page: |
| 62 | + |
| 63 | +<img src="/docs/images/aws/github-oauth-app-client-id-secret.png" |
| 64 | + alt="Github Oauth App Client ID Secret" |
| 65 | + class="mt-3 mb-3 border border-info rounded"> |
| 66 | + |
| 67 | +Go to your [Auth0 Dashboard](https://manage.auth0.com/dashboard/), after log into Auth0 Dashboard, select **Connections > Social**, then choose Github. Copy the `Client ID` and `Client Secret` from the `Developer Applications` of your app on Github into the fields on this page on Auth0. |
| 68 | + |
| 69 | +<img src="/docs/images/aws/auth0-github-setup.png" |
| 70 | + alt="Auth0 Github Setup" |
| 71 | + class="mt-3 mb-3 border border-info rounded"> |
| 72 | + |
| 73 | +Then click **SAVE** button and go to the [Auth0 Dashboard](https://manage.auth0.com/dashboard/), take a note about the `Client ID` and `Client Secret`, which are found on your Auth0 application. |
| 74 | + |
| 75 | +<img src="/docs/images/aws/auth0-app-client-id-secret.png" |
| 76 | + alt="Auth0 App ClienID and ClientSecret" |
| 77 | + class="mt-3 mb-3 border border-info rounded"> |
| 78 | + |
| 79 | +### 5. Deploy Kubeflow |
| 80 | + |
| 81 | +Download [kfctl_aws_cognito.v1.0.0.yaml](https://raw.githubusercontent.com/kubeflow/manifests/v1.0-branch/kfdef/kfctl_aws_cognito.v1.0.0.yaml). Before you `kfctl apply -V -f kfctl_aws_cognito.v1.0.0.yaml`, please update **spec** and **repos** fields in your Kubeflow configuration file at `kfctl_aws_cognito.v1.0.0.yaml`, so that it looks like this: |
| 82 | +``` |
| 83 | +plugins: |
| 84 | +- kind: KfAwsPlugin |
| 85 | + metadata: |
| 86 | + name: aws |
| 87 | + spec: |
| 88 | + auth: |
| 89 | + oidc: |
| 90 | + certArn: arn:aws:acm:us-west-2:########:certificate/#######-#####-###-# |
| 91 | + oAuthClientId: Your Auth0 App Client Id |
| 92 | + oAuthClientSecret: Your Auth0 App Client Secret |
| 93 | + oidcAuthorizationEndpoint: https://kftest.auth0.com/authorize |
| 94 | + oidcIssuer: https://kftest.auth0.com/ |
| 95 | + oidcTokenEndpoint: https://kftest.auth0.com/oauth/token |
| 96 | + oidcUserInfoEndpoint: https://kftest.auth0.com/userinfo |
| 97 | + region: us-west-2 |
| 98 | + enablePodIamPolicy: true |
| 99 | + repos: |
| 100 | + - name: manifests |
| 101 | + uri: https://github.com/kubeflow/manifests/archive/v1.0-branch.tar.gz |
| 102 | +``` |
| 103 | + |
| 104 | +After you finish the TLS and Authentication configuration, then you can run `kfctl apply -V -f kfctl_aws_cognito.v1.0.0.yaml`. |
| 105 | + |
| 106 | +After a while, your ALB will be ready, you can get ALB hostname by running follow command. |
| 107 | + |
| 108 | +``` |
| 109 | +kubectl get ingress istio-ingress -n istio-system |
| 110 | +NAME HOSTS ADDRESS PORTS AGE |
| 111 | +istio-ingress * 322ac077-istiosystem-istio-2af2-786120677.us-west-2.elb.amazonaws.com 80 56s |
| 112 | +``` |
| 113 | + |
| 114 | +On Auth0 dashboard, click `Applications` on the left navigation bar, modify your ALB Hostname with prefix `https://` and postfix `/oauth2/idpresponse` in `Allowed Callback URLs` as below image: |
| 115 | + |
| 116 | +<img src="/docs/images/aws/auth0-callback-url.png" |
| 117 | + alt="Auth0 App Callback URL" |
| 118 | + class="mt-3 mb-3 border border-info rounded"> |
| 119 | + |
| 120 | +## Succeed example |
| 121 | + |
| 122 | +After you set up above steps, navigate the application from `https://Your ALB HostName` and you'll see a webpage like below: |
| 123 | + |
| 124 | +<img src="/docs/images/aws/alb-login.png" |
| 125 | + alt="ALB Hostname Login" |
| 126 | + class="mt-3 mb-3 border border-info rounded"> |
| 127 | + |
| 128 | +After you login with Github, you should succeed in seeing a kubeflow dashboard webpage. |
0 commit comments