docs: add kubernetes (#33)

- Update PR template to use Go language conventions.
- Moved healthcheck middleware to hijack a request before logging.
- Rewrote the quickstart guides to follow a similar pattern.
- Added an overview blurb on pomerium and its goals.
- Add an "example config" section to docs.
This commit is contained in:
Bobby DeSimone 2019-01-27 22:22:14 -08:00 committed by GitHub
parent b1912128f3
commit bcecee5ee3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 663 additions and 105 deletions

83
docs/guide/kubernetes.md Normal file
View file

@ -0,0 +1,83 @@
# Kubernetes
This quickstart will show you how to deploy Pomerium with Kubernetes. For the purpose of this guide, we will be using Google's Kubernetes Engine. However, there are countless ways to work with Kubernetes:
- [Google Kubernetes Engine (GKE)](https://cloud.google.com/kubernetes-engine/)
- [Azure Kubernetes Service](https://azure.microsoft.com/en-us/services/kubernetes-service/)
- [Amazon Elastic Kubernetes Service (Amazon EKS)](https://aws.amazon.com/eks/)
- [OpenShift Kubernetes](https://www.openshift.com/learn/topics/kubernetes/)
- Or locally, with [minikube](https://kubernetes.io/docs/setup/minikube/)
Most of the following steps should be very similar using any other provider.
:::tip
Google Cloud Platform has a [free trial with $300 credits](https://cloud.google.com/free/docs/gcp-free-tier).
:::
## Prerequisites
- A [Google Cloud Account](https://console.cloud.google.com/)
- A configured [identity provider]
- Install [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
- Install the [Google Cloud SDK](https://cloud.google.com/kubernetes-engine/docs/quickstart)
## Download
Retrieve the latest copy of pomerium's source-code by cloning the repository.
```bash
git clone https://github.com/pomerium/pomerium.git $HOME/pomerium
```
## Configure
Edit the the [example kubernetes files][./scripts/kubernetes_gke.sh] to match your [identity provider] settings:
- `./docs/docs/examples/authenticate.deploy.yml`
- `./docs/docs/examples/authenticate.service.yml`
- `./docs/docs/examples/proxy.deploy.yml`
- `./docs/docs/examples/proxy.service.yml`
- `./docs/docs/examples/ingress.yml`
Place your domain's wild-card TLS certificate (`privkey.pem` and `cert.pem`) in the root of the repository. If you don't have one handy, the included [script] generates one from [LetsEncrypt].
Edit [./scripts/kubernetes_gke.sh] making sure to change the identity provider secret value to match your [identity provider] settings.
## Run
Run [./scripts/kubernetes_gke.sh] which will:
1. Provision a new cluster
2. Create authenticate and proxy [deployments](https://cloud.google.com/kubernetes-engine/docs/concepts/deployment).
3. Provision and apply authenticate and proxy [services](https://cloud.google.com/kubernetes-engine/docs/concepts/service).
4. Configure an ingress to do serve TLS between client and load balancer
```bash
sh ./scripts/kubernetes_gke.sh
```
You should see roughly the following in your terminal. Note, provisioning does take a few minutes.
[![asciicast](https://asciinema.org/a/223821.svg)](https://asciinema.org/a/223821)
And if you check out Google's Kubernetes Engine dashboard you'll see something like:
![Google's Kubernetes Engine dashboard](./kubernetes-gke.png)
## Navigate
Open a browser and navigate to `httpbin.your.domain.com`.
You should see something like the following in your browser.
![Getting started](./get-started.gif)
[./scripts/kubernetes_gke.sh]: ../docs/examples.html#google-kubernetes-engine
[example kubernetes files]: ../docs/examples.html#google-kubernetes-engine
[helloworld]: https://hub.docker.com/r/tutum/hello-world
[httpbin]: https://httpbin.org/
[identity provider]: ../docs/identity-providers.md
[letsencrypt]: https://letsencrypt.org/
[script]: https://github.com/pomerium/pomerium/blob/master/scripts/generate_wildcard_cert.sh