Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Kamaji Setup using Kind and MetalLb #665

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions docs/content/getting-started/kind.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Kamaji: Getting started on Kind
This guide will lead you through the process of creating a setup of a working Kamaji setup using Kind clusters.

The guide requires the following installed:

- Docker
- Kind
- Helm

## Summary

* [Creating Kind Cluster](#creating-kind-cluster)
* [Installing Dependencies: Cert-Manager](#installing-dependencies-cert-manager)
* [Installing MetalLb](#installing-metallb)
* [Creating IP Address Pool](#creating-ip-address-pool)
* [Installing Kamaji](#installing-kamaji)


## Creating Kind Cluster

Create a kind cluster.
```
kind create cluster --name kamaji
```

This will take a short while for the kind cluster to created.

## Installing Dependencies: Cert-Manager

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.

Add the Bitnami Repo to the Helm Manager.
```
helm repo add bitnami https://charts.bitnami.com/bitnami
```

Install Cert Manager to the cluster using the bitnami charts using Helm --
```
helm upgrade --install cert-manager bitnami/cert-manager --namespace certmanager-system --create-namespace --set "installCRDs=true"
```

This will install cert-manager to the cluster. You can watch the progress of the installation on the cluster using the command -
```
kubectl get pods -Aw
```

!!! Info ""
Another pre-requisite is to have a __storage provider__.

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.

## Installing MetalLb

MetalLB is used in order to dynamically assign IP addresses to the components, and also define custom IP Address Pools.

Install MetalLb using the `kubectl` manifest apply command --
```
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml
```

This will install MetalLb onto the cluster with all the necessary resources.

## Creating IP Address Pool

Extract the Gateway IP of the network Kind is running on.
```
GW_IP=$(docker network inspect -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}' kind)
```

Modify the IP Address, and create the resource to be added to the cluster to create the IP Address Pool.
```
NET_IP=$(echo ${GW_IP} | sed -E 's|^([0-9]+\.[0-9]+)\..*$|\1|g')
cat << EOF | sed -E "s|172.19|${NET_IP}|g" | kubectl apply -f -
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: kind-ip-pool
namespace: metallb-system
spec:
addresses:
- 172.19.255.200-172.19.255.250
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: emtpy
namespace: metallb-system
EOF
```

## Installing Kamaji

- Add the Clastix Repo in the Helm Repo lists.
```
helm repo add clastix https://clastix.github.io/charts
helm repo update
```

- Install Kamaji
```
helm upgrade --install kamaji clastix/kamaji --namespace kamaji-system --create-namespace --set 'resources=null'
```

- Watch the progress of the deployments --
```
kubectl get pods -Aw
```

- Verify by first checking Kamaji CRDs.
```
kubectl get crds | grep -i kamaji
```

- Install a Tenant Control Plane using the command --

```
kubectl apply -f https://raw.githubusercontent.com/clastix/kamaji/master/config/samples/kamaji_v1alpha1_tenantcontrolplane.yaml
```

- Watch the progress of the Tenant Control Plane by ---
```
kubectl get tcp -w
```

- You can attempt to get the details of the control plane by downloading the kubeconfig file ---
```
# Set the SECRET as KUBECONFIG column listed in the tcp output.
SECRET=""
kubectl get secret $SECRET -o jsonpath='{.data.admin\.conf}'|base64 -d > /tmp/kamaji.conf
```

- Export the KUBECONFIG
```
export KUBECONFIG=/tmp/kamaji.conf
```

- Notice that the `kubectl` version changes, and there is no nodes now.
```
kubectl version
kubectl get nodes
```

A Video Tutorial of the [demonstration](https://www.youtube.com/watch?v=hDTvnOyUmo4&t=577s) can also be viewed.
4 changes: 3 additions & 1 deletion docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ markdown_extensions:
# Generate navigation bar
nav:
- 'Kamaji': index.md
- 'Getting started': getting-started.md
- 'Getting started':
- getting-started/getting-started.md
- getting-started/kind.md
- 'Concepts': concepts.md
- 'Guides':
- guides/index.md
Expand Down
Loading