It is an introduction study to Kubernetes. The proposal:
Specifications include:
- A
setup.sh
to... set things up. - Dockerfiles written by me.
- One service for container.
- Use of Alpine Linux.
- nginx on ports 80 and 443 with auto-redirect from 80 to 443. Access through SSH on port 22.
- Single IP Load Balancer, only entry point. MetalLB recommended.
- WordPress on 5050 and redirect 307 from /wordpress.
- phpMyAdmin on port 5000 and reverse proxy from /phpmyadmin.
- MySQL.
- FTPS on port 21.
- Grafana monitoring all containers, on port 3000, linked to InfluxDB (on separate container). One dashboard per service.
FORBIDDEN:
- NodePort, Ingress Controller, kubectl port forward, DockerHub.
Let's get it on clustering!
./setup.sh
: resets Minikube and mount everything over. You must be sudo because of virtual-inside-virtual (minikube driver=none
) setup.ctl/logs.sh
: logs current Kubernetes status.ctl/unit.sh
: run some tests. Requires python3 and lftp. Editctl/unit.sh
to setup the default user and password.
user | paswd | role | |
---|---|---|---|
nginx | user42 | user42 | admin |
ftps | user42 | user42 | admin |
mysql | user42 | user42 | admin |
wordpress | user42 | user42 | admin |
wordpress | user42b | user42b | subscriber |
wordpress | user42c | user42c | contributor |
wordpress | user42d | user42d | author |
wordpress | user42e | user42e | editor |
phpmyadmin | user42 | user42 | admin |
grafana | admin | admin | admin |
- Minikube version < 10 does not support virtualization inside virtualization (at least on my Oracles Virtual Machine). For this reason, this project uses
--vm-drive=none
, this also implies Minikube must be sudo run. Please install the latest version and conntrack:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mkdir -p /usr/local/bin
sudo install minikube /usr/local/bin
sudo apt install conntrack # for driver=none
- Check users and groups:
sudo groupadd docker
sudo usermod -aG docker user42
newgrp docker
- Kill any running server:
sudo pkill nginx
- Use
ssh user42@$(minikube ip)
; password: "user42". - To login into ftps, use:
lftp $(minikube ip)
. Thenset ssl:verify-certificate no
anduser user42
; password: "user42". - Three volumes are persistent and shared, the sql db, influx and /home (/home is accessible through ssh
nginx:22
and ftpftps
). - Use
source <(kubectl completion zsh)
for extra adrenaline when interacting withkubectl
.
this project is part of the 42 São Paulo cursus
Copyright 2021 fde-capu
This is how I have made a Kubernetes project, afterall, researching on the Internet. I am happy if you find it usefull to your studies. If you find anything profitable, do not use it without getting in touch, and we can work together.