Skip to content

Deployment Overview of MicroK8s on Server

Prerequisites and Basic Requirements

To ensure a successful deployment, the following requirements must be met:

  • Operating System: Ubuntu

  • Privileges: Root or sudo access is required for all installation steps.

  • Package Manager: apt and snapd must be available.

  • Network Access: The server requires outbound internet access to download packages via apt and snap.

Application Installation Process

The application is installed using a combination of system package management and the Snap package manager. The installation process follows these steps:

  1. Docker Engine Installation: Docker is installed on the host system to support containerized workloads.

  2. Package Index Update: The apt package index is updated to ensure all dependencies are current.

  3. Snapd Installation: The snapd service is installed via apt.

  4. MicroK8s Installation: MicroK8s (version 1.31/stable) is installed using the Snap package manager with the --classic confinement flag.

  5. User Configuration: The root user is added to the microk8s group to allow necessary permissions for cluster management.

  6. Addon Activation: The following MicroK8s addons are enabled:

  7. dns: Provides internal DNS services within the cluster.

  8. hostpath-storage: Provides local storage capabilities using host paths.

  9. dashboard: Deploys the Kubernetes web-based user interface.

  10. CLI Configuration: A command alias is created so that kubectl can be used directly via microk8s kubectl.

Docker Containers and Their Deployment

The deployment includes a specialized Nginx container managed via Docker Compose to handle SSL certificate management.

Service Image Ports Volumes Environment Variables Restart Policy
nginx jonasal/nginx-certbot:latest Host Network Mode - nginx_secrets:/etc/letsencrypt
- /data/nginx/user_conf.d:/etc/nginx/user_conf.d
[email protected] unless-stopped

Custom Scripts and Additional Setup

The following actions are performed during the initial setup to ensure service availability:

  • Dashboard Access Token Generation: An access token is generated for the Kubernetes Dashboard using the command microk8s kubectl create token default.

  • Port Forwarding: A background process is initiated to forward the Kubernetes Dashboard port from the cluster to the host at 10443:443 to allow external management access.

Location of Configuration Files and Data

The following paths are used for configuration and persistent data:

  • Nginx/Certbot Secrets: Managed via an external Docker volume named nginx_secrets.

  • Nginx User Configurations: /data/nginx/user_conf.d

  • Nginx Environment Variables: /data/nginx/nginx-certbot.env

Available Ports for Connection

The following ports are utilized by the application:

  • 10443: Kubernetes Dashboard (via port forwarding).

  • 80/443: Managed via Nginx in host network mode for SSL termination.

Starting and Stopping the Application

Management of the MicroK8s service is performed using the following commands:

  • Check Status: microk8s status

  • Enable Addons: microk8s enable <addon_name>

  • Kubectl Command Usage: Use kubectl (via the created alias) for all cluster management tasks.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×