Skip to content

This repository contains scripts to provision different services on a local Kubernetes cluster.

Notifications You must be signed in to change notification settings

foroozf001/kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes

This repository contains scripts and instructions to provision local Kubernetes environments.

Kind

Kind allows provisioning multi-node clusters on Docker containers. The advantage of using Kind is that it closely represents production-like environments and it provisions incredibly fast.

Prerequisites

Step-by-step

  1. The Kind cluster runs on a custom Docker network: kind. We require the Kind CIDR in order to allocate a narrow range of IPs to Metallb. Metallb is a layer 7 load balancing solution for bare-metal Kubernetes clusters. Inspect the Kind network to determine the CIDR range.
$ docker network inspect -f '{{range .IPAM.Config}}{{.Subnet}}{{"\n"}}{{end}}' kind | head -n1
172.18.0.0/16
  1. From the CIDR range we pick a sensible IP-range for Metallb to use (172.18.255.200-172.18.255.250). These IPs will be dynamically allocated to Kubernetes LoadBalancer services. Update setup/metallb.cm.yaml according to the chosen IP range.
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 172.18.255.200-172.18.255.250
  1. Spinning up the Kind cluster is as simple as running the Makefile.
$ make cluster
kind create cluster --config=setup/config.yaml
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.21.1) 🖼
 ✓ Preparing nodes 📦 📦 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
 ✓ Joining worker nodes 🚜 
  1. Inspect worker node availability.
$ kubectl get no
NAME                 STATUS   ROLES                  AGE     VERSION
kind-control-plane   Ready    control-plane,master   2m21s   v1.21.1
kind-worker          Ready    <none>                 105s    v1.21.1
kind-worker2         Ready    <none>                 105s    v1.21.1
  1. Clean the Kind cluster.
$ make clean
kind delete cluster
Deleting cluster "kind" ...

About

This repository contains scripts to provision different services on a local Kubernetes cluster.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published