Deployment Overview of MicroK8s on Server¶
Prerequisites and Basic Requirements¶
-
Operating System: Ubuntu Linux.
-
Privileges: Root access is required to perform the installation and manage system services.
-
Package Manager:
aptfor system updates andsnapdfor MicroK8s installation. -
Network: The server must have outbound internet access to download packages and certificates.
FQDN of the Final Panel¶
Based on the provided configuration, no specific FQDN in the format <prefix><Server ID>.hostkey.in:<port> is defined for a user-facing web panel. The MicroK8s Dashboard is exposed locally via port forwarding.
File and Directory Structure¶
The deployment utilizes the following paths for data and configuration storage:
| Path | Description |
|---|---|
/snap/bin | Location of microk8s and kubectl binaries. |
/data/nginx/nginx-certbot.env | Environment file for Nginx and Certbot configuration. |
/data/nginx/user_conf.d | Directory for custom Nginx user configurations. |
/etc/letsencrypt | Mount point for SSL certificate storage (via named volume). |
Application Installation Process¶
The MicroK8s cluster is installed as a Snap package using the 1.31/stable channel. The installation process involves the following steps:
-
Update the
aptpackage index. -
Install the
snapdpackage if not already present. -
Install MicroK8s via Snap:
-
Add the current user to the
microk8sgroup to enable command execution withoutsudofor cluster management. -
Enable essential addons for DNS, storage, and the dashboard:
-
Wait for the cluster to become ready:
-
Create a shell alias for
kubectl:
Docker Containers and Their Deployment¶
A containerized Nginx service is deployed using Docker Compose. The configuration includes:
-
Image:
jonasal/nginx-certbot:latest -
Restart Policy:
unless-stopped -
Network Mode:
host -
Environment Variables:
-
CERTBOT_EMAIL: Set to[email protected] -
Additional settings loaded from
/data/nginx/nginx-certbot.env
-
-
Volumes:
-
nginx_secrets: An external volume mounted at/etc/letsencryptfor SSL certificates. -
/data/nginx/user_conf.d: Mounted at/etc/nginx/user_conf.dfor custom Nginx configurations.
-
The deployment utilizes the docker-compose tool to manage the Nginx container lifecycle based on the provided YAML definition.
Proxy Servers¶
The Nginx container acts as a reverse proxy and handles SSL certificate management using Certbot.
-
Configuration File:
/data/nginx/nginx-certbot.env -
Custom Configs: Placed in
/data/nginx/user_conf.d -
SSL Storage: Managed via the
nginx_secretsvolume at/etc/letsencrypt.
Access Rights and Security¶
-
User Group: The
rootuser is added to themicrok8sgroup to manage the cluster. -
Firewall: No specific firewall rules or port restrictions are defined in the provided configuration files.
-
Access Control: Access to the Kubernetes dashboard is granted via a token generated by
kubectl.
Starting, Stopping, and Updating¶
-
Dashboard Access Token: To access the MicroK8s dashboard, generate a token using:
-
Port Forwarding: To access the dashboard, port
10443on the host is forwarded to port443of the dashboard service: -
Container Management: Docker containers managed by Compose can be started, stopped, or updated using standard
docker composecommands corresponding to the project directory containingcompose.yml.
Available Ports for Connection¶
-
10443: Local port for accessing the MicroK8s Dashboard (requires active port-forwarding process).
-
80/443: Standard HTTP/HTTPS ports handled by the Nginx container in host network mode.