Template repository that helps to autosetup VPS(-es) or nodes with Kubernetes. Intended for porting the installation from one cloud provider to another, getting started with fullstack applications faster and automating the whole setup while doing so.
The following components can be installed:
- public facing load balancer
- kubernetes dashboard
- letsencrypt for SSL certificates
- plausible analytics (with databases)
- email server (mailcow)
- authentication manager (keycloak) (TODO)
- database (postgres or mongo) (TODO)
- docker registry (harbor) (TODO)
- helm charts for deploying custom applications by modifying image name, tags and environment variables
- skaffold for local development with file sync and deployment
Add your SSH public key to the authorized_keys
file on the VPS (Optional).
Create a dotenv file with environment variables as secrets:
MAIN_NODE_IP=<your vps ip>
MAIN_NODE_SSH_PORT=<your vps ssh port>
TOP_LEVEL_DOMAIN=<your domain example.com>
ADMIN_EMAIL=<your admin email >
PLAUSIBLE_PASSWORD=<your plausible password>
MAILCOW_ADMIN_PASSWORD=<your mailcow admin password>
KEYCLOAK_ADMIN_PASSWORD=<your keycloak admin password>
POSTGRES_PASSWORD=<your postgres password>
To install docker and kubernetes:
chmod +x install.sh
./install.sh docker
./install.sh kubernetes
sudo reboot
Ensure cri-dockerd
(which is installed with docker install sequence) is working correctly before proceeding with Kubernetes setup.
Currently the version of cri-dockerd
is not pinned, so it may change in the future. If you encounter issues, please check the cri-dockerd repository.
After installing Kubernetes, setup the cluster:
To export credentials:
export KUBECONFIG=/etc/kubernetes/admin.conf
- Remove node taint to allow scheduling of pods in the control plane node, if necessary (especially for single-node clusters):
kubectl taint nodes <node-name> node-role.kubernetes.io/control-plane:NoSchedule-
- Install the Calico CNI plugin for networking:
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
- To install all tools at once:
skaffold run
- Adding nodes to the cluster (untested):
kubeadm token create --print-join-command
and run the command on the new node to join it to the cluster.
Goto:
nano /etc/ssh/sshd_config
and uncomment the port line and change it to your desired port, e.g. Port 2222
.