Kubernetes objects definitions for deploying Nextcloud with MySQL
Deploying example on a fresh Arch Linux install with Minikube
Install Docker, Minikube, kubectl and nginx:
sudo pacman -S docker minikube kubectl nginx
Add user to docker group:
sudo gpasswd -a $USER docker
Reboot:
sudo reboot
These dirs will be used as persistent volumes in Kubernetes.
cd
mkdir data
mkdir data/nextcloud
mkdir data/nextcloud/data
mkdir data/nextcloud/config
mkdir data/nextcloud/apps
mkdir data/mysql
Start Minikube specifying in which dir persistent volumes will be mounted
minikube start --mount --mount-string="$HOME/data:/home/docker/data" --driver=docker
git clone https://github.com/mrgian/kubernetes-nextcloud-deploy.git
cd kubernetes-nextcloud-deploy
kubectl apply -f mysql-config.yaml
kubectl apply -f mysql-secret.yaml
kubectl apply -f mysql.yaml
kubectl apply -f nextcloud.yaml
minikube service nextcloud-service
The Nextcloud instance will be available at the shown URL.
If you are running Kubernetes in Minikube, you may want your Nextcloud instance to be accessible from outside. You can setup a reverse proxy with Nginx
Edit nginx.conf:
sudo nano /etc/nginx/nginx.conf
Configure the reverse proxy:
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://192.168.49.2:30001;
}
}
Restart Nginx:
sudo systemctl restart nginx