This repository contains my local Kubernetes dev environment powered by k3d from Rancher
ℹ️ The script will install all required missing softwares
- 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
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.
Run the following command to start the voyage. The script will guide you to setup your cluster
$ ./devship
To use the local registry, please follow the instructions below
- Check if registry contrainer is up and running
$ docker ps | grep "registry"
- Pull
nginx:alpine
image
$ docker pull nginx:alpine
- 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
- 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
- Check if the pod is running fine or not
$ kubectl get pods -l "app=nginx-test-registry"
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
- Add Docker Registry UI
- Add Kube-VIP support