/k3c

k3s setup with docker-compose

Primary LanguageShell

AIC 2023 - Group 7 - Topic 4

Repository for the AIC 2023 - Group 7 - Topic 4 project.

I started by creating a local Kubernetes cluster with a single control-plane node and multiple worker nodes. Kubernetes is useful for dynamically provisioning containers and manage network configurations for our assignment. The cluster is created using k3s and cilium as CNI. I would aim to use the same setup for the final deployment.

The cluster and all its components are created using a simple docker-compose up -d.

Initial Development Environment Setup

echo "K3S_TOKEN=${RANDOM}${RANDOM}${RANDOM}" > .env
echo "K3S_VERSION=v1.28.2-k3s1" >> .env
export KUBECONFIG=$(pwd)/kubeconfig.yaml

Start Project Environment with Docker Compose and access the Kubernetes Dashboard

This creates a local Kubernetes cluster with a single master node and multiple worker nodes. The cluster is created using k3s and cilium as CNI.

# This also works without the Development Setup step
docker-compose up -d

Open the DASHBOARD in chrome and skip authentication (already configured)

Use kubectl to Interact with the Cluster

see: kubectl reference

export KUBECONFIG=$(pwd)/kubeconfig.yaml
kubectl get all --all-namespaces

Purge Project Environment with Docker Compose

docker-compose down --remove-orphans --volumes

Configuration of the cluster

The cluster is configured using static deployments mounted via docker from the ./k3s/manifests directory.

See: k3s manifests docs