Skip to content

Latest commit

 

History

History
99 lines (81 loc) · 3.19 KB

README.md

File metadata and controls

99 lines (81 loc) · 3.19 KB

Kubernetes Multi-Cluster Dev Setup

This repository contains my local Kubernetes dev environment powered by k3d from Rancher

Prerequisites

  1. Kubernetes CLI
  2. Docker Desktop
  3. k3d
  4. Helm

ℹ️ The script will install all required missing softwares

Features

  • Kubernetes cluster with multi Control Plane (Server) and multi Agents (Workers)
  • Host directory mounted as PersistentVolume called <cluster-name>-pv
  • Use existing network for cluster
  • Seamless Local Registry Integration
  • Ingress Nginx with custom certificates

More coming soon...

📝 NOTE: The script disables Taerifik Ingress Controller comes with K3D

Generate certificates and HostMapping

While creating cluster the script search for {CLUSTER_DOMAIN}-key.pem and {CLUSTER_DOMAIN}.pem as key and certificate file during setting up tls secret for Nginx Ingress Controller. You need to create SSL key and certificate for your domain and put it into certs directory following the naming pattern.

Start Voyage on Kubernetes Devship

Run the following command to start the voyage. The script will guide you to setup your cluster

$ ./devship

Using local registry

To use the local registry, please follow the instructions below

  1. Check if registry contrainer is up and running
$ docker ps | grep "registry"
  1. Pull nginx:alpine image
$ docker pull nginx:alpine
  1. Tag nginx:alpine as follows and push it
 $ docker tag nginx:alpine <registry-container-name>:5000/nginx:alpine
 $ docker push <registry-container-name>:5000/nginx:alpine
  1. Deploy a Pod referencing the image pushed into the local registry in the step above as follows
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-test-registry
  labels:
    app: nginx-test-registry
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-test-registry
  template:
    metadata:
      labels:
        app: nginx-test-registry
    spec:
      containers:
      - name: nginx-test-registry
        image: <registry-container-name>:5000/nginx:alpine
        ports:
        - containerPort: 80
EOF
  1. Check if the pod is running fine or not
$ kubectl get pods -l "app=nginx-test-registry"

Using Ingress with TLS

The script prompt you to setup Nginx Ingress Controller using Bitnami Nginx Ingress Helm Chart with the TLS support.

If you did not setup ingress during creation of the cluster, you can install it following the steps described in Setup Nginx Ingress Controller

Todo

  • Add Docker Registry UI
  • Add Kube-VIP support