|
| 1 | +# Kamaji: Getting started on Kind |
| 2 | +This guide will lead you through the process of creating a setup of a working Kamaji setup using Kind clusters. |
| 3 | + |
| 4 | +The guide requires the following installed: |
| 5 | + |
| 6 | +- Docker |
| 7 | +- Kind |
| 8 | +- Helm |
| 9 | + |
| 10 | +## Summary |
| 11 | + |
| 12 | + * [Creating Kind Cluster](#creating-kind-cluster) |
| 13 | + * [Installing Dependencies: Cert-Manager](#installing-dependencies-cert-manager) |
| 14 | + * [Installing MetalLb](#installing-metallb) |
| 15 | + * [Creating IP Address Pool](#creating-ip-address-pool) |
| 16 | + * [Installing Kamaji](#installing-kamaji) |
| 17 | + |
| 18 | + |
| 19 | +## Creating Kind Cluster |
| 20 | + |
| 21 | +Create a kind cluster. |
| 22 | +``` |
| 23 | +kind create cluster --name kamaji |
| 24 | +``` |
| 25 | + |
| 26 | +This will take a short while for the kind cluster to created. |
| 27 | + |
| 28 | +## Installing Dependencies: Cert-Manager |
| 29 | + |
| 30 | +Kamaji has a dependency on Cert Manager, as it uses dynamic admission control, validating and mutating webhook configurations which are secured by a TLS communication, these certificates are managed by `cert-manager`. Hence, it needs to be added. |
| 31 | + |
| 32 | +Add the Bitnami Repo to the Helm Manager. |
| 33 | +``` |
| 34 | +helm repo add bitnami https://charts.bitnami.com/bitnami |
| 35 | +``` |
| 36 | + |
| 37 | +Install Cert Manager to the cluster using the bitnami charts using Helm -- |
| 38 | +``` |
| 39 | +helm upgrade --install cert-manager bitnami/cert-manager --namespace certmanager-system --create-namespace --set "installCRDs=true" |
| 40 | +``` |
| 41 | + |
| 42 | +This will install cert-manager to the cluster. You can watch the progress of the installation on the cluster using the command - |
| 43 | +``` |
| 44 | +kubectl get pods -Aw |
| 45 | +``` |
| 46 | + |
| 47 | +!!! Info "" |
| 48 | + Another pre-requisite is to have a __storage provider__. |
| 49 | + |
| 50 | + Kind by default provides `local-path-provisioner`, but one can have any other CSI Drivers. Since there are ETCD and Control-Planes running, having persistent volumes is essential for the cluster. |
| 51 | + |
| 52 | +## Installing MetalLb |
| 53 | + |
| 54 | +MetalLB is used in order to dynamically assign IP addresses to the components, and also define custom IP Address Pools. |
| 55 | + |
| 56 | +Install MetalLb using the `kubectl` manifest apply command -- |
| 57 | +``` |
| 58 | +kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml |
| 59 | +``` |
| 60 | + |
| 61 | +This will install MetalLb onto the cluster with all the necessary resources. |
| 62 | + |
| 63 | +## Creating IP Address Pool |
| 64 | + |
| 65 | +Extract the Gateway IP of the network Kind is running on. |
| 66 | +``` |
| 67 | +GW_IP=$(docker network inspect -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}' kind) |
| 68 | +``` |
| 69 | + |
| 70 | +Modify the IP Address, and create the resource to be added to the cluster to create the IP Address Pool. |
| 71 | +``` |
| 72 | +NET_IP=$(echo ${GW_IP} | sed -E 's|^([0-9]+\.[0-9]+)\..*$|\1|g') |
| 73 | +cat << EOF | sed -E "s|172.19|${NET_IP}|g" | kubectl apply -f - |
| 74 | +apiVersion: metallb.io/v1beta1 |
| 75 | +kind: IPAddressPool |
| 76 | +metadata: |
| 77 | + name: kind-ip-pool |
| 78 | + namespace: metallb-system |
| 79 | +spec: |
| 80 | + addresses: |
| 81 | + - 172.19.255.200-172.19.255.250 |
| 82 | +--- |
| 83 | +apiVersion: metallb.io/v1beta1 |
| 84 | +kind: L2Advertisement |
| 85 | +metadata: |
| 86 | + name: emtpy |
| 87 | + namespace: metallb-system |
| 88 | +EOF |
| 89 | +``` |
| 90 | + |
| 91 | +## Installing Kamaji |
| 92 | + |
| 93 | +- Add the Clastix Repo in the Helm Repo lists. |
| 94 | +``` |
| 95 | +helm repo add clastix https://clastix.github.io/charts |
| 96 | +helm repo update |
| 97 | +``` |
| 98 | + |
| 99 | +- Install Kamaji |
| 100 | +``` |
| 101 | +helm upgrade --install kamaji clastix/kamaji --namespace kamaji-system --create-namespace --set 'resources=null' |
| 102 | +``` |
| 103 | + |
| 104 | +- Watch the progress of the deployments -- |
| 105 | +``` |
| 106 | +kubectl get pods -Aw |
| 107 | +``` |
| 108 | + |
| 109 | +- Verify by first checking Kamaji CRDs. |
| 110 | +``` |
| 111 | +kubectl get crds | grep -i kamaji |
| 112 | +``` |
| 113 | + |
| 114 | +- Install a Tenant Control Plane using the command -- |
| 115 | + |
| 116 | +``` |
| 117 | +kubectl apply -f https://raw.githubusercontent.com/clastix/kamaji/master/config/samples/kamaji_v1alpha1_tenantcontrolplane.yaml |
| 118 | +``` |
| 119 | + |
| 120 | +- Watch the progress of the Tenant Control Plane by --- |
| 121 | +``` |
| 122 | +kubectl get tcp -w |
| 123 | +``` |
| 124 | + |
| 125 | +- You can attempt to get the details of the control plane by downloading the kubeconfig file --- |
| 126 | +``` |
| 127 | +# Set the SECRET as KUBECONFIG column listed in the tcp output. |
| 128 | +SECRET="" |
| 129 | +kubectl get secret $SECRET -o jsonpath='{.data.admin\.conf}'|base64 -d > /tmp/kamaji.conf |
| 130 | +``` |
| 131 | + |
| 132 | +- Export the KUBECONFIG |
| 133 | +``` |
| 134 | +export KUBECONFIG=/tmp/kamaji.conf |
| 135 | +``` |
| 136 | + |
| 137 | +- Notice that the `kubectl` version changes, and there is no nodes now. |
| 138 | +``` |
| 139 | +kubectl version |
| 140 | +kubectl get nodes |
| 141 | +``` |
| 142 | + |
| 143 | +A Video Tutorial of the [demonstration](https://www.youtube.com/watch?v=hDTvnOyUmo4&t=577s) can also be viewed. |
0 commit comments