Skip to content

MAHDTech/nkp-quickstart

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nutanix Kubernetes Platform - Quickstart Guide

TL;DR

Steps to install all the required CLIs (nkp, kubectl and helm) to create and manage NKP clusters.

  1. Add NKP Rocky Linux image from the Nutanix Support Portal to Prism Central

  2. Create a jump host with 2 vCPUs, 4 GB memory, use the Rocky image (update disk to 128 GiB), and the following Cloud-init custom script

    #cloud-config
    ssh_pwauth: true
    chpasswd:
      expire: false
      users:
      - name: nutanix
        password: nutanix/4u # Recommended to change the password or update the script to use SSH keys
        type: text
    bootcmd:
    - mkdir -p /etc/docker
    write_files:
    - content: |
        {
            "insecure-registries": ["registry.nutanixdemo.com"]
        }
      path: /etc/docker/daemon.json
    runcmd:
    - '[ ! -f "/etc/yum.repos.d/nutanix_rocky9.repo" ] || mv -f /etc/yum.repos.d/nutanix_rocky9.repo /etc/yum.repos.d/nutanix_rocky9.repo.disabled'
    - dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
    - dnf -y install docker-ce docker-ce-cli containerd.io
    - systemctl --now enable docker
    - usermod -aG docker nutanix
    - 'curl -Lo /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl'
    - chmod +x /usr/local/bin/kubectl
    - 'curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash'
    - eject
    - 'wall "If you are seeing this message, please reconnect your SSH session. Otherwise, the NKP CLI installation process may fail."'
    final_message: "The machine is ready after $UPTIME seconds. Go ahead and install the NKP CLI using: $ curl -sL https://raw.githubusercontent.com/nutanixdev/nkp-quickstart/main/scripts/get-nkp-cli | bash"
  3. SSH to nutanix@<jump host_IP> (default password: nutanix/4u)

  4. Install the NKP CLI with the command:

    curl -fsSL https://raw.githubusercontent.com/nutanixdev/nkp-quickstart/main/scripts/get-nkp-cli | bash

    When prompted, you must use the download link as-is, which is available in the Nutanix portal.

Table of Contents

  1. Overview

  2. Prerequisites Checklist

  3. Deploy Linux jump host

  4. Install NKP CLI

  5. (Optional) Create NKP Cluster on Nutanix

Overview

The NKP CLI is a command-line interface for managing NKP-based workflows. This guide provides a quick and easy way to install the required CLIs (nkp, kubectl and helm) using the Rocky Linux image provided by Nutanix in the Nutanix Support Portal.

Prerequisites Checklist

For NKP CLI:

  • Internet connectivity

  • Add NKP Rocky Linux to Prism Central. DO NOT CHANGE the auto-populated image name

    click to view example

(Optional) For NKP cluster creation:

  • Static IP address for the control plane VIP
  • One or more IP addresses for the NKP dashboard and load balancing service

Deploy Linux jump host

  1. Connect to Prism Central

  2. Create a virtual machine

    • Name: nkp-jump host

    • vCPUs: 2

    • Memory: 4

    • Disk: Clone from Image (select the Rocky Linux you previously uploaded)

    • Disk Capacity: 128 (default is 20)

    • Guest Customization: Cloud-init (Linux)

    • Custom Script:

      #cloud-config
      ssh_pwauth: true
      chpasswd:
        expire: false
        users:
        - name: nutanix
          password: nutanix/4u # Recommended to change the password or update the script to use SSH keys
          type: text
      bootcmd:
      - mkdir -p /etc/docker
      write_files:
      - content: |
          {
              "insecure-registries": ["registry.nutanixdemo.com"]
          }
        path: /etc/docker/daemon.json
      runcmd:
      - '[ ! -f "/etc/yum.repos.d/nutanix_rocky9.repo" ] || mv -f /etc/yum.repos.d/nutanix_rocky9.repo /etc/yum.repos.d/nutanix_rocky9.repo.disabled'
      - dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
      - dnf -y install docker-ce docker-ce-cli containerd.io
      - systemctl --now enable docker
      - usermod -aG docker nutanix
      - 'curl -Lo /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl'
      - chmod +x /usr/local/bin/kubectl
      - 'curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash'
      - eject
      - 'wall "If you are seeing this message, please reconnect your SSH session. Otherwise, the NKP CLI installation process may fail."'
      final_message: "The machine is ready after $UPTIME seconds. Go ahead and install the NKP CLI using: $ curl -sL https://raw.githubusercontent.com/nutanixdev/nkp-quickstart/main/scripts/get-nkp-cli | bash"
    click to view example
  3. Power on the virtual machine

Install NKP CLI

  1. Connect to your jump host using SSH (default password: nutanix/4u)

    ssh nutanix@<jump host_IP>
  2. Install the NKP CLI with the command:

    curl -fsSL https://raw.githubusercontent.com/nutanixdev/nkp-quickstart/main/scripts/get-nkp-cli | bash

    When prompted, you must use the download link as-is, which is available in the Nutanix portal.

(Optional) Create NKP cluster on Nutanix

  1. Before you start, ensure you meet the prerequisites:

    • Static IP address for the control plane VIP
    • One or more IP addresses for the NKP dashboard and load-balancing service

    Note: The IP addresses must be in the same subnet as the virtual machines.

  2. Choose one of the following two installation methods:

    • Prompt-based installation. Use this method when the Internet connection for the NKP cluster isn’t shared with more users.
    • CLI installation. Use this method when the Internet connection for the NKP cluster is shared between many users.

Prompt-based installation

This installation method gives less control on the cluster configuration. For example, the NKP cluster will be created with three control plane nodes and four worker nodes.

nkp create cluster nutanix

CLI installation

This installation method lets you fully customize your cluster configuration. The following commands create a cluster with one control plane node and three worker nodes.

  1. Before running the following command in your jump host VM, update the values with your environment:

    export NKP_VERSION=2.12.0                                       # NKP version to install
    export CLUSTER_NAME=nkp                                         # NKP cluster name. When using NKP Pro/Ultimate, this name is used to generate the license key
    export NUTANIX_USER=admin                                       # Prism Central username
    export NUTANIX_PASSWORD=''                                      # Keep the password enclosed between single quotes - Ex: 'password'
    export NUTANIX_ENDPOINT=                                        # Prism Central IP address
    export NUTANIX_PORT=9440                                        # Prism Central port (default: 9440)
    export LB_IP_RANGE=                                             # Load balancer IP range - Ex: 10.42.236.204-10.42.236.204
    export CONTROL_PLANE_ENDPOINT_IP=                               # Kubernetes VIP. Must be in the same subnet as the VMs - Ex: 10.42.236.203
    export NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME=nkp-rocky-9.4-release-1.29.6-20240816215147.qcow2 # Update with the NKP Rocky image name
    export NUTANIX_PRISM_ELEMENT_CLUSTER_NAME=                      # Prism Element cluster name - Ex: PHX-POC207
    export NUTANIX_SUBNET_NAME=                                     # Ex: primary
    export NUTANIX_STORAGE_CONTAINER_NAME=SelfServiceContainer      # Change to your preferred Prism storage container
    export REGISTRY_MIRROR_URL=registry.nutanixdemo.com/docker.io   # Required on Nutanix HPOC
  2. The next command will start the installation process of an NKP management cluster:

    nkp create cluster nutanix -c $CLUSTER_NAME \
        --kind-cluster-image $REGISTRY_MIRROR_URL/mesosphere/konvoy-bootstrap:v$NKP_VERSION \
        --endpoint https://$NUTANIX_ENDPOINT:$NUTANIX_PORT \
        --insecure \
        --kubernetes-service-load-balancer-ip-range $LB_IP_RANGE \
        --control-plane-endpoint-ip $CONTROL_PLANE_ENDPOINT_IP \
        --control-plane-vm-image $NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME \
        --control-plane-prism-element-cluster $NUTANIX_PRISM_ELEMENT_CLUSTER_NAME \
        --control-plane-subnets $NUTANIX_SUBNET_NAME \
        --control-plane-replicas 1 \
        --worker-vm-image $NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME \
        --worker-prism-element-cluster $NUTANIX_PRISM_ELEMENT_CLUSTER_NAME \
        --worker-subnets $NUTANIX_SUBNET_NAME \
        --worker-replicas 3 \
        --csi-storage-container $NUTANIX_STORAGE_CONTAINER_NAME \
        --csi-hypervisor-attached-volumes=false \
        --registry-mirror-url http://$REGISTRY_MIRROR_URL \
        --self-managed

Support and Disclaimer

These code samples are intended as standalone examples. Please be aware that all public code samples provided by Nutanix are unofficial in nature, are provided as examples only, are unsupported, and will need to be heavily scrutinized and potentially modified before they can be used in a production environment. All such code samples are provided on an as-is basis, and Nutanix expressly disclaims all warranties, express or implied. All code samples are © Nutanix, Inc., and are provided as-is under the MIT license (https://opensource.org/licenses/MIT).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%