docs/examples/auth/oauth-external-auth/README.md
The auth-url and auth-signin annotations allow you to use an external
authentication provider to protect your Ingress resources.
!!! Important
This annotation requires ingress-nginx-controller v0.9.0 or greater.
This functionality is enabled by deploying multiple Ingress objects for a single host. One Ingress object has no special annotations and handles authentication.
Other Ingress objects can then be annotated in such a way that require the user to
authenticate against the first Ingress's endpoint, and can redirect 401s to the
same endpoint.
Sample:
...
metadata:
name: application
annotations:
nginx.ingress.kubernetes.io/auth-url: "https://$host/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://$host/oauth2/start?rd=$escaped_request_uri"
...
This example will show you how to deploy oauth2_proxy
into a Kubernetes cluster and use it to protect the Kubernetes Dashboard using GitHub as the OAuth2 provider.
Install the kubernetes dashboard
kubectl create -f https://raw.githubusercontent.com/kubernetes/kops/master/addons/kubernetes-dashboard/v1.10.1.yaml
Create a custom GitHub OAuth application
https://foo.bar.com/oauth2/callback, like https://foo.bar.com/oauth2/callbackConfigure values in the file oauth2-proxy.yaml with the values:
<Client ID><Client Secret>python -c 'import os,base64; print(base64.b64encode(os.urandom(16)).decode("ascii"))'__INGRESS_HOST__ with a valid FQDN (e.g. foo.bar.com)__INGRESS_SECRET__ with a Secret with a valid SSL certificateDeploy the oauth2 proxy and the ingress rules by running:
$ kubectl create -f oauth2-proxy.yaml
Test the integration by accessing the configured URL, e.g. https://foo.bar.com
This example will show you how to deploy Vouch Proxy
into a Kubernetes cluster and use it to protect the Kubernetes Dashboard using GitHub as the OAuth2 provider.
Install the kubernetes dashboard
kubectl create -f https://raw.githubusercontent.com/kubernetes/kops/master/addons/kubernetes-dashboard/v1.10.1.yaml
Create a custom GitHub OAuth application
https://foo.bar.com/oauth2/auth, like https://foo.bar.com/oauth2/authConfigure Vouch Proxy values in the file vouch-proxy.yaml with the values:
<Ingress Host><Client ID><Client Secret>__INGRESS_HOST__ with a valid FQDN (e.g. foo.bar.com)__INGRESS_SECRET__ with a Secret with a valid SSL certificateDeploy Vouch Proxy and the ingress rules by running:
$ kubectl create -f vouch-proxy.yaml
Test the integration by accessing the configured URL, e.g. https://foo.bar.com