@@ -6,19 +6,29 @@ This document will allow you to set up dex in your Kubernetes cluster; the examp
The document assumes that you already have a cluster with at least one worker up and running. The easiest way to bring up a small cluster for experimentation is the [coreos-kubernetes single node](coreos-kubernetes-single-node) Vagrant installer.
The other assumption is that your Kubernetes cluster will be routable on `172.17.4.99` (which is what it will be if you use [coreos-kubernetes single node][coreos-kubernetes-single-node], and the issuer URL for your dex installation is `http://172.17.4.99:30556`; in production installations you will need to make sure that you are serving on https and you will likely want to use a hostname rather than an IP address.
The other assumption is that your Kubernetes cluster will be running an appropriate Ingress controller for your environment (see below, or for more advanced or cloud-specific options, see [the Kubernetes Ingress Docs](http://kubernetes.io/docs/user-guide/ingress/#ingress-controllers)).
Additionally, make sure that a `dex.example.com` DNS or `/etc/hosts` entry has been made pointing to the ingress controller Node IP(s).
If you do not already have an ingress controller in place, and if you'd like to use the latest kubernetes/contrib nginx ingress controller, simply run the following:
Dex needs a database to store information; these commands will create a Postgres service that dex can use. Note that this configuration is not suitable for production - if the container is destroyed, the data is gone forever.
In production you should have a sufficiently fault-tolerant Postgres deployment on a persistent volume with backup.
In production you should have a sufficiently fault-tolerant and secure (TLS enabled) Postgres deployment on a persistent volume with backup.
```
kubectl create -f postgres-rc.yaml
kubectl create -f postgres-service.yaml
```bash
kubectl apply -f postgres.yaml
```
## Create your secrets.
...
...
@@ -27,17 +37,23 @@ dex needs a secret key for encrypting private keys in the database. These can be
Start the overlord. This will also initialize your database the first time it's run, and perform migrations when new versions are installed.
```
kubectl create -f dex-overlord-rc.yaml
kubectl create -f dex-overlord-service.yaml
```bash
kubectl apply -f dex-overlord.yaml
```
Note: this will make the admin API available to any pod in the cluster. This API is very powerful, and allows the creation of admin users who can perform any action in dex, including creating, modifying and deleting other users. This will be fixed soon by requirng some sort of authentication.
...
...
@@ -52,72 +68,54 @@ inside a pod via `kubectl exec`. (note that if your DB is not running on the clu
The other hacky thing is that this needs to happen before the workers start because workers do not (yet!) respond dynamically to connector configuration changes.
First, start a shell session on the overlord pod.
```
DEX_OVERLORD_POD=$(kubectl get pod -l=app=dex,role=overlord -o template --template "{{ (index .items 0).metadata.name }}")
kubectl exec -ti $DEX_OVERLORD_POD -- sh
```
Once we're on the pod, we create a connectors file and upload it to dex.
```bash
DEX_OVERLORD_POD=$(kubectl get pod -l=app=dex,role=overlord -o template --template"{{ (index .items 0).metadata.name }}")