Skip to content

nurrony/devship

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

119 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (Opt-In)
  • Use existing network for cluster
  • Seamless Local Registry Integration
  • Ability to install TLS for services that ensures E2E Secure connection even for local environment
  • Use podman as container runtime (see)

More coming soon...

Generate certificates and HostMapping

While creating cluster the script search for {CLUSTER_DOMAIN}.key and {CLUSTER_DOMAIN}.crt as key and certificate file during setting up tls secret. 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"

Install and access HeadLamp Kubernetes Dashboard

The script comes with ready to go installation of HeadLamp Kubernetes Dashboard (A replacement of Legacy Kubernetes Dashboard) during the cluter setup process. If you do not install Headlamp during cluster setup then, follow these instructions to install and access the dashboard

helm repo add headlamp https://kubernetes-sigs.github.io/headlamp/
helm repo update
helm install my-headlamp headlamp/headlamp --namespace kube-system
kubectl apply -f extras/headlamp.yaml
kubectl create token headlamp-admin --namespace kube-system

📝 NOTE: Please do not forget to replace headlamp.<your-cluster-fqdn> with actual cluster FQDN before executing the commands above

Using Ingress with TLS

The script prompt you to setup traefik Ingress Controller using Traefik 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 using Bitnami Nginx Ingress Helm Chart

Todo

  • Enable Traefik Dashboard
  • Add Docker Registry UI
  • Add Kube-VIP support

About

My Kubernetes Development Environment powered by K3D (Battery Included)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages