Single-Node Kubernetes Setup

This guide provides instructions for setting up a single-node Kubernetes cluster using either microk8s or k3s.

Prerequisites

Hardware Requirements

  • 4 Cores

  • 16 GB RAM

  • 50GB disk space

  • Static private IP address

Operating System Requirements

  • Ubuntu 20.04 LTS or later (for microk8s)

  • Any Linux distribution with systemd (for k3s)

Installation Options

Choose one of the following installation methods:

microk8s Installation

1. Install microk8s

# Install microk8s
sudo snap install microk8s --classic

# Add user to microk8s group
sudo usermod -a -G microk8s $USER
sudo chown -R $USER ~/.kube

# Apply changes
newgrp microk8s

2. Wait for Service

# Check status (5 minute timeout)
microk8s status --wait-ready --timeout 300

3. Enable Required Add-ons

# Enable necessary features
microk8s enable metrics-server
microk8s enable dns

4. Configure Access

# Set up kubectl alias
alias kubectl='microk8s kubectl'

# Verify access
kubectl get nodes

k3s Installation

1. Install k3s

# Install k3s
curl -sfL https://get.k3s.io | sh -

# Wait for service
sudo systemctl status k3s

2. Configure Access

# Set KUBECONFIG
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
sudo chmod 644 /etc/rancher/k3s/k3s.yaml

# Verify access
kubectl get nodes

Deploy Observo Site

1. Get Configuration

  1. Access Observo dashboard

  2. Navigate to Settings → Sites

  3. Download helm configuration file

2. Modify Configuration

Update the following in your helm values file:

global:
  pushSource:
    loadBalancerEnabled: false
  
metrics-server:
  enabled: false

3. Deploy Site

# For microk8s
microk8s kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.0/cert-manager.crds.yaml
microk8s helm upgrade --install -n observo-client observo-site \
    oci://public.ecr.aws/e4z0a1h1/observo-site \
    --create-namespace \
    --values=/path/to/downloaded_config.yaml

# For k3s
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.0/cert-manager.crds.yaml
helm upgrade --install -n observo-client observo-site \
    oci://public.ecr.aws/e4z0a1h1/observo-site \
    --create-namespace \
    --values=/path/to/downloaded_config.yaml

Configure Host Access

1. Install nginx

sudo apt install nginx-full
sudo apt install nginx-extras

2. Get Service IP

# Get data-plane service IP
kubectl get services -n observo-client data-plane-gateway-service

3. Configure nginx

# Create stream configuration directory
sudo mkdir -p /etc/nginx/conf.d/stream

# Create configuration file
sudo tee /etc/nginx/conf.d/stream/tcp-proxy.conf << 'EOF'
stream {
    map $server_port $destination_port {
        default 10001; 
        ~^(\d+)$ $1; 
    }

    server {
        listen 10001-10050;
        proxy_pass <data-plane-gateway-service-cluster-ip>:$destination_port;
        proxy_connect_timeout 1s;
    }
} 
EOF

4. Update nginx Configuration

# Edit main nginx configuration
sudo tee -a /etc/nginx/nginx.conf << 'EOF'
include /etc/nginx/conf.d/stream/*.conf;
EOF

# Restart nginx
sudo systemctl restart nginx

Verify Installation

1. Check Components

# Check pods
kubectl get pods -n observo-client

# Check services
kubectl get svc -n observo-client

2. Test Connectivity

# Test HTTP endpoint
curl -v http://localhost:10001/health

# Test UDP endpoint
nc -zu localhost 10001

Troubleshooting

Common Issues

Pod Startup Issues

# Check pod status
kubectl describe pod -n observo-client <pod-name>

# Check logs
kubectl logs -n observo-client <pod-name>

Network Issues

# Check nginx configuration
sudo nginx -t

# Check nginx logs
sudo tail -f /var/log/nginx/error.log

Next Steps

Additional Resources

Last updated

Was this helpful?