Creating a Private Kubernetes Cluster with Hostspace Kubernetes Engine (HKE)

Creating a Private Kubernetes Cluster with Hostspace Kubernetes Engine (HKE)

Introduction

Welcome to HostSpaceNG’s Managed Kubernetes on Virtual Machines (VMs). This guide will take you through setting up a private Kubernetes cluster using HostSpace Kubernetes Engine (HKE). This guide is specifically for private clusters that are only accessible using a jumpserver and with limited ports open to the internet.

Step 1: Create VM Instances (Nodes) for the Cluster

In this step, you will create the virtual machine (VM) instances that will serve as nodes in your Kubernetes cluster.

  1. Choose a Cloud Provider: You can create a virtual machine (VM) on any cloud provider like GCP, AWS, Azure, or local providers such as Nobus. Ensure that the VM meets the system requirements for running Kubernetes. For this guide, DigitalOcean is used for the demonstration.

  2. Create VM Instances: Create a jumpserver and node instances needed for the cluster. Ensure that the jumpsever and nodes are in the same region and have a high availability configuration.

  3. Create Firewall Rules: Create firewall rules that restrict access to the nodes. These are the rules used for this guide.

    For this demonstration, two instances were created for the nodes.

    • Ensure the following ports are open to facilitate communication within your Kubernetes cluster:

    • Common Ports:

      • 22 (SSH): For secure shell access. Only the jumpserver should have access to this port.

      • 16443 and 8443: For Kubernetes API server communications.

      • 10250-10255: For kubelet communications, crucial for management tasks and health checks within the cluster.

    • Additional Ports for HA Setup:

      • 19001 and 25000: These ports need to be open on all nodes to allow them to join a Highly Available (HA) cluster.

    • Port for Non-HA Setup:

      • 25000: This port needs to be open on all nodes in a Non-HA cluster setup.

    • Port needed by pods for DNS resolution(UDP):

      • 4789: This port needs to be open and restricted to the node instances. This is required by the pods for its DNS resolution

    • Port for Metric Setup:

      • 4443: This port needs to be open on all nodes needed to export NetData metrics to user's HKE Dashboard.

Step 2: Accessing HKE Interface

  1. Navigate to HKE: Open your browser and head over to ui.hostspaceng.com. Select deploy with Managed Kubernetes. To read more about deploying with managed containers, click here.

Step 3: Create a Kubernetes Cluster

In this step, you will use the Hostspace Kubernetes Engine (HKE) interface to create your Kubernetes cluster.

  1. Input Cluster Details:

    • Jumpserver Option: Select yes to bring up the interface needed for a jumpserver setup.

    • Instance IP: Enter the public IP address(es) of the VM instance(s) you created. If you have multiple IPs, separate them using a comma, enter key, or tab key.

    • Jumpserver IP: Enter the public IP address of the jumpsever instance.

    • Private SSH Key or Password: Enter the private SSH key or password of the jumpsever user used to access the node instances.

    • Cluster Name: Enter a name for your Kubernetes cluster.

    • Username: Provide the username that matches the SSH username used in accessing the instance. Note this user should have root permissions. These permissions will be required for the cluster creation.

  2. Create Cluster: After filling out the details, click the 'Create Cluster' button to initiate the cluster provisioning.

Step 4: Connect to the Kubernetes Cluster

Once the cluster is created, you will get redirected to a page where you can view information about your Kubernetes cluster, add or delete nodes etc

You can connect to the cluster by clicking on the connect to the cluster button

  1. Download kubeconfig File: Once the cluster is created, download the kubeconfig file from the HKE interface. This file is necessary to connect to your Kubernetes cluster.

  2. Connect Using kubectl:

    • Open a terminal on your computer.

    • Use the command to verify connectivity to your Kubernetes cluster.

    kubectl --kubeconfig=path_to_your_kubeconfig_file get nodes

Congratulations! You have successfully set up your Kubernetes cluster with HostSpaceNG’s HKE. You are now ready to deploy and manage applications in a scalable and highly available environment.

Troubleshooting and Support

If you encounter any issues

Last updated