1. Answers
  2. Deploying Kubernetes on Nutanix

How do I deploy Kubernetes on Nutanix?

In this guide, we will deploy a Kubernetes cluster on Nutanix using Pulumi. We will define the necessary resources such as the Karbon cluster, node pools, and other configurations to set up a fully functional Kubernetes environment.

import * as pulumi from "@pulumi/pulumi";
import * as nutanix from "@pierskarsenbarg/nutanix";

// Define the Kubernetes cluster
const k8sCluster = new nutanix.KarbonCluster("k8sCluster", {
    name: "my-k8s-cluster",
    version: "1.21.5",
    cniConfig: {
        podIpv4Cidr: "172.16.0.0/16",
        serviceIpv4Cidr: "10.96.0.0/12",
        nodeCidrMaskSize: 24,
    },
    etcdNodePool: {
        name: "etcd-pool",
        numInstances: 3,
        nodeOsVersion: "centos7",
        ahvConfig: {
            cpu: 4,
            diskMib: 20480,
            memoryMib: 16384,
            networkUuid: "network-uuid",
            prismElementClusterUuid: "cluster-uuid",
        },
    },
    masterNodePool: {
        name: "master-pool",
        numInstances: 3,
        nodeOsVersion: "centos7",
        ahvConfig: {
            cpu: 4,
            diskMib: 20480,
            memoryMib: 16384,
            networkUuid: "network-uuid",
            prismElementClusterUuid: "cluster-uuid",
        },
    },
    workerNodePool: {
        name: "worker-pool",
        numInstances: 3,
        nodeOsVersion: "centos7",
        ahvConfig: {
            cpu: 4,
            diskMib: 20480,
            memoryMib: 16384,
            networkUuid: "network-uuid",
            prismElementClusterUuid: "cluster-uuid",
        },
    },
    externalLbConfig: {
        masterNodesConfigs: [
            { ipv4Address: "192.168.1.10", nodePoolName: "master-pool" },
            { ipv4Address: "192.168.1.11", nodePoolName: "master-pool" },
            { ipv4Address: "192.168.1.12", nodePoolName: "master-pool" },
        ],
        externalIpv4Address: "192.168.1.100",
    },
    storageClassConfig: {
        name: "default",
        reclaimPolicy: "Delete",
        volumesConfig: {
            username: "admin",
            password: pulumi.secret("password"),
            storageContainer: "default-container",
            prismElementClusterUuid: "cluster-uuid",
        },
    },
});

export const clusterName = k8sCluster.name;
export const clusterVersion = k8sCluster.version;

Key Points

  • Defined a KarbonCluster resource to deploy a Kubernetes cluster on Nutanix.
  • Configured etcd, master, and worker node pools with necessary specifications.
  • Set up an external load balancer configuration for the master nodes.
  • Configured storage class for the cluster.

Summary

In this guide, we deployed a Kubernetes cluster on Nutanix using Pulumi. We defined the cluster configuration, node pools, load balancer, and storage class to create a fully functional Kubernetes environment.

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up