Skip to content

alecharn/nkp-easy-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NKP Easy Setup

This project provides a fully automated installation script for Nutanix Kubernetes Platform (NKP) from a Rocky Linux bastion.

πŸ’­ Personal Note

I developed this project to streamline the NKP installation process within my lab environment. While comprehensive, this project may not address every possible scenario and might require customization for different use cases. Please consider it as a foundational reference and adapt it to meet your specific requirements and environment constraints.

πŸ“‹ Overview

The project automates the complete installation process of NKP from a fresh Rocky Linux system, including all dependencies, tools, and cluster creation. It supports both proxy and direct internet environments.

It includes a web-based configuration UI that provides an intuitive interface for setting up environment variables, validating configurations, and executing the NKP installation with real-time progress monitoring and log streaming.

πŸ—‚οΈ Project Structure

NKP Installation/
β”œβ”€β”€ nkp-easy-setup.sh          # Main installation script
β”œβ”€β”€ launch-ui.sh               # HTTP server launcher for configuration UI
β”œβ”€β”€ ui/                        # Web-based configuration UI
β”‚   β”œβ”€β”€ index.html             # Main UI page
β”‚   β”œβ”€β”€ styles.css             # UI styling
β”‚   β”œβ”€β”€ script.js              # UI functionality
β”‚   └── server.py              # Python HTTP server with API endpoints
β”œβ”€β”€ .env.example               # Configuration template
β”œβ”€β”€ .gitignore                 # Git ignore patterns
└── README.md                  # Detailed installation guide
└── nkp-easy-setup-ui.png      # Screenshot of the configuration UI

πŸš€ Quick Start

0. Prerequisites

Before starting the NKP installation, ensure you have the following requirements in place:

Deploy a Rocky Linux Bastion VM in your Nutanix cluster

Deploy a Rocky Linux virtual machine on your target Nutanix cluster that will serve as the installation bastion. The nkp-easy-setup UI and/or script will be executed from this VM.

  • OS Version: Rocky Linux 9.6+ (this is what I tested)
  • VM Resources (that I tested): 4 vCPUs, 16 GiB RAM, 200 GiB Disk (scale up if needed - we'll be pulling down quite a few packages and tools! πŸ“¦)
  • Network Connectivity: VM requires access to Nutanix Prism Central and internet (supports both direct and proxy configurations)
  • Access: Root/sudo privileges required for installation

Upload to Prism Central the NKP Node OS Image (Rocky Linux)

Connect to Nutanix Support Portal, download the NKP Node OS Image (Rocky Linux) that matches the version of your NKP download link, and upload it to Prism Central before starting the installation.

This image will be used as the base image for NKP nodes created by NKP during cluster deployment.

Final step: Connect to the Rocky Linux bastion VM

After deploying the Rocky Linux bastion VM, use SSH to connect to it:

ssh your-username@bastion-vm-ip

1. Clone/Download the Project

# Download or clone this project to your Rocky Linux system
git clone https://github.com/alecharn/nkp-easy-setup.git
cd nkp-easy-setup

Note : before cloning the repo, you might have to configure a proxy on your terminal if you are behind a corporate proxy:

export http_proxy="http://your-proxy-host.company.com:8080"
export https_proxy="http://your-proxy-host.company.com:8080"
export HTTP_PROXY="http://your-proxy-host.company.com:8080"
export HTTPS_PROXY="http://your-proxy-host.company.com:8080"

Note bis : before cloning, you might have to install git if it's not already installed:

sudo dnf install git -y

2. Configure Environment and Run Installation

Option A: Use the Configuration UI (Recommended) 🎨

Web-based Configuration UI with Installation Execution - Complete end-to-end solution with real-time validation and log streaming.

# Launch the HTTP server for the configuration UI
sudo ./launch-ui.sh

Access: http://localhost:8080 or http://your-vm-ip:8080

NKP Easy Setup Configuration UI

Workflow:

  1. Fill the form with all the required variables (an existing .env file can also be imported to auto-populate the fields)
  2. Generate and save .env file to server
  3. Validate .env file (required before installation)
  4. Execute NKP installation with real-time logs

Option B: Manual Configuration πŸ“

# Copy the template and edit with your values
cp .env.example .env
sudo nano .env  # or use your preferred editor

# Run the installation
sudo ./nkp-easy-setup.sh

βš™οΈ Configuration

Required Environment Variables

The .env file must be configured with your specific environment details:

Proxy Configuration (if behind corporate proxy)

PROXY_HOST="your-proxy-host.company.com"
PROXY_PORT="8080"
PROXY_PROTOCOL="http"
NO_PROXY_IPS="your-internal-ips"
Note:
For Direct Internet Access
# In .env file, leave proxy settings empty:
PROXY_HOST=""
PROXY_PORT=""
PROXY_PROTOCOL=""

NKP Download Link

NKP_DOWNLOAD_LINK="https://your-nkp-download-link.com"
Note:

To obtain the NKP download link:

  1. Log in to the Nutanix Support Portal
  2. Navigate to Downloads > "Nutanix Kubernetes Platform (NKP)"
  3. Select the appropriate NKP version for your environment (NKP for Linux)
  4. Copy the download URL from the download button/link
  5. Don't forget to also download the NKP Node OS Image (Rocky Linux) and upload it to Prism Central

Nutanix Environment

CLUSTER_NAME="nkp-demo" # NKP Cluster Name
NUTANIX_ENDPOINT="https://your-prism-central:9440/" # Prism Central URL
NUTANIX_USER="admin" # Prism Central Username
NUTANIX_PASSWORD="your-password" # Prism Central Password
NUTANIX_CLUSTER="your-nutanix-cluster" # Prism Element Cluster Name on which to deploy NKP
STORAGE_CONTAINER_NAME="your-storage-container" # Storage Container Name for persistent volumes

Network Configuration

CONTROLPLANE_IP="your-control-plane-ip" # Control Plane IP
SERVICE_LB_IP_RANGE="your-lb-ip-range" # Service Load Balancer IP Range
SUBNET="your-subnet" # Subnet Name for NKP nodes
KUBERNETES_PODS_NETWORK="192.168.0.0/16" # Kubernetes Pods Network CIDR, default is 192.168.0.0/16
KUBERNETES_SERVICES_NETWORK="10.96.0.0/12" # Kubernetes Services Network CIDR, default is 10.96.0.0/12

VM Configuration

VM_IMAGE="your-vm-image" # VM Image Name for NKP nodes
SSH_USERNAME="your-ssh-user" # SSH Username
SSH_PUBLIC_KEY_PATH="$HOME/.ssh/id_rsa.pub" # SSH Public Key Path (will be generated by the script if it does not exist)

Resource Configuration

# Control Plane
CONTROL_PLANE_REPLICAS="1" # Number of Control Plane Replicas
CONTROL_PLANE_VCPUS="8" # Number of vCPUs for Control Plane
CONTROL_PLANE_CORES_PER_VCPU="1" # Cores per vCPU for Control Plane
CONTROL_PLANE_MEMORY_GIB="32" # Memory (GiB) for Control Plane

# Worker Nodes
WORKER_REPLICAS="3" # Number of Worker Replicas
WORKER_VCPUS="8" # Number of vCPUs for Worker Nodes
WORKER_CORES_PER_VCPU="1" # Cores per vCPU for Worker Nodes
WORKER_MEMORY_GIB="16" # Memory (GiB) for Worker Nodes

πŸ› οΈ What Gets Installed and Deployed

The installation script automatically installs and configures:

System Components

  • System package updates
  • Essential development tools
  • Docker CE with proxy configuration
  • SSH key generation

Kubernetes Tools

  • kubectl - Kubernetes command-line tool
  • Helm - Kubernetes package manager
  • k9s - Terminal-based Kubernetes UI
  • NKP - Nutanix Kubernetes Platform CLI

Cluster Creation

  • NKP cluster deployment on Nutanix infrastructure
  • Control plane and worker node configuration
  • Network and storage integration

πŸ“ Post-Installation

After successful installation:

# Check cluster status
kubectl --kubeconfig="$HOME/{CLUSTER_NAME}.conf" get nodes

# Access cluster with k9s
k9s --kubeconfig="$HOME/{CLUSTER_NAME}.conf" -A

# Get dashboard credentials
nkp get dashboard --kubeconfig="$HOME/{CLUSTER_NAME}.conf"

πŸ” Troubleshooting

Common Issues

  1. Missing .env file:

    • UI Method: Use ./launch-ui.sh to start the web server and access the configuration UI from your browser to generate the .env file
    • Manual Method: Copy .env.example to .env and configure all required variables
  2. Configuration UI not accessible:

    • Ensure Python is installed (python3 or python)
    • Check port 8080 availability (the script automatically allows firewall connectivity)
    • For bastion VM: Verify network connectivity
  3. Installation issues:

    • Validate .env file before executing installation
    • Monitor real-time logs in the UI
    • Check installation progress bar for current phase
  4. Proxy connectivity: Verify proxy settings (the UI provides smart proxy configuration)

  5. Nutanix connectivity: Ensure your system can reach Prism Central on port 9440

Log Analysis

The script provides colored logging:

  • 🟒 Green: Successful operations
  • 🟑 Yellow: Warnings
  • πŸ”΄ Red: Errors
  • πŸ”΅ Blue: Information

πŸ“‹ Prerequisites

  • Rocky Linux 9.6 (tested environment)
  • Root/sudo access
  • Internet connectivity (direct or via proxy)
  • Access to Nutanix Prism Central
  • Valid NKP download link from Nutanix Downloads Portal
  • Python 3.x for the configuration UI server
  • Port 8080 available for UI server

πŸ“„ License

This project is provided as-is for demonstration and educational purposes.

About

Provides a fully automated installation script for Nutanix Kubernetes Platform (NKP) with user-interface.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors