-
Notifications
You must be signed in to change notification settings - Fork 45
Kubernetes
Optionally, you can develop locally on Kubernetes which is how CHEFS is deployed in production.
You'll need to install Kubernetes on your machine, in this tutorial, we'll be using microk8s
. You can follow this install guide for your operating system. I've also turned on the services dns
, registry
, metallb
, and ingress
. On MacOS, this looks like:
brew install ubuntu/microk8s/microk8s
microk8s install
microk8s status --wait-ready
microk8s enable dns
microk8s enable registry
You'll need to know what your local IP address is for the next step. You'll need to inform metallb of the range of IP addresses it can use in your network. For example, my IP address is 192.168.1.53
. So I'm going to give metallb the IP addresses in the range 192.168.1.200-192.168.1.250
microk8s enable metallb
microk8s enable ingress
Follow the install guide for your operating system to install Terraform.
Create a file called terraform.tfvars
, you'll be placing some variables in here. You can obtain the variables you need by running the following command:
kubectl config view --minify --flatten --context=microk8s
It should look like this:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1...
server: https://192.168.64.2:16443
name: microk8s-cluster
contexts:
- context:
cluster: microk8s-cluster
user: admin
name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
user:
token: UythU0V6VDhIY2h..
Inside of your terraform.tfvars
file, you'll want to define the following variables:
-
kubernetes_host
corresponds toclusters.cluster.server
-
kubernetes_cluster_ca_certificate
corresponds toclusters.cluster.certificate-authority-data
-
kubernetes_token
corresponds tousers.user.token
Your resultant file should look like:
kubernetes_host = "https://192.168.64.2:16443"
kubernetes_cluster_ca_certificate = "LS0tLS1CRUdJTi..."
kubernetes_token = "UythU0V6VDhIY..."
Initialize Terraform:
terraform init
Apply the Terraform file to deploy it:
terraform apply