From 3024e25c09afd10a1190a30e1acad93c93555eb5 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 11 May 2022 13:27:31 -0500 Subject: [PATCH] example: Add Kubernetes multi-service (#1092) * example: Add Kubernetes multi-service * fix: change to CODER_AGENT_TOKEN * example: use ServiceAccount for cluster authentication (#1096) Co-authored-by: Ben --- examples/kubernetes-multi-service/README.md | 77 ++++++++++++ examples/kubernetes-multi-service/main.tf | 132 ++++++++++++++++++++ 2 files changed, 209 insertions(+) create mode 100644 examples/kubernetes-multi-service/README.md create mode 100644 examples/kubernetes-multi-service/main.tf diff --git a/examples/kubernetes-multi-service/README.md b/examples/kubernetes-multi-service/README.md new file mode 100644 index 0000000000..dd9944f4b2 --- /dev/null +++ b/examples/kubernetes-multi-service/README.md @@ -0,0 +1,77 @@ +--- +name: Develop multiple services in Kubernetes +description: Get started with Kubernetes development. +tags: [cloud, kubernetes] +--- + +# Authentication + +This template has several ways to authenticate to a Kubernetes cluster. + +## kubeconfig (Coder host) + +If the Coder host has a local `~/.kube/config`, this can be used to authenticate with Coder. Make sure this is on the same user running the `coder` service. + +## ServiceAccount + +Create a ServiceAccount and role on your cluster to authenticate your template with Coder. + +1. Run the following command on a device with Kubernetes context: + + ```sh + CODER_NAMESPACE=default + kubectl apply -n $CODER_NAMESPACE -f - <