Deploy Kubernetes Cluster On-Premises

Objectives

  1. Deploy simple master (single) and worker node (single) Kubernetes cluster for demo purposes
  2. Configure kubectl
  3. Use Helm to deploy WordPress to a cluster

Before you get started

To use Kublr, you’ll need to download and install Kublr Demo/Installer at https://kublr.com/deploy//

Prerequisites

System Requirements for the cluster nodes

  1. x86 64-bit hardware

  2. Hardware recommendation

  3. Supported OS on nodes:

    • RHEL 7.2+ or Ubuntu 16.04 LTS
    • RHEL 8 is supported only in Kubernetes v.1.17 and selinux must be in permissive mode
  4. Root access to each node

  5. Nodes are connected in your network and Kublr Demo/Installer configured IP is accessible from these nodes (ping)

  6. From your nodes, firewall rules should allow traffic to Kublr Demo/Installer on ports 9080 / 9443

  7. 100Mbs stable internet connection

  8. Kublr Demo/Installer should be correctly configured to be accessible in your local network. It is critical that you provide the correct IP address during the virtual machine startup. If you skipped this step, please re-run provisioning and configure your firewall rules to allow traffic to your computer.

    For details on how to re-run Kublr Demo/Installer, see “KUBLR_HOST” information at the Kublr Quick Start.

Determine Your Own IP Address

Creating a cluster in your machine’s network is simple. Use your machine’s IP address for this network. If you don’t know how to get the IP address, contact your system administrator or read your OS manual.

To install Kublr clusters in a different network on complex network topologies, provide the IP address of your machine from that network.

Creating On-Premises Cluster in Kublr

Powered by Kublr, Vanilla Kubernetes Cluster does not include any advanced Kublr features, suitable for running workloads.

See some cluster parameters description here.

To add a new on-premises cluster:

  1. On the left menu, click Clusters.

  2. Click Add Cluster. Add New Cluster The Select Installation Type dialog is displayed.

  3. In the Select Installation Type dialog, click Cluster.

  4. Click Continue Setup. Installation Type - Cluster The ADD CLUSTER dialog is displayed.

  5. In the ADD CLUSTER dialog, set Provider to “Bring Your Own Infrastructure”.

  6. Specify Cluster Name.

  7. Select Kublr Agent.

  8. Specify Kubernetes Version. On-Premises-Add Cluster-General Settings

  9. If necessary, expand the Advanced Options and set them.

  10. Click the INSTANCES step.

  11. Use the Master Configuration section.

  12. Specify the parameters of the master node(s) of your cluster as described below.

  13. From the Masters list, select the number of master or management nodes.

  14. If more than one master is selected, set the Load Balancer Address.

  15. Select Installation Type:

    • Automated using SSH: for this type, set User Name, SSH Key Name and, for each master, IP/DNS of Matster X.
    • Manual: for this type, set IP/DNS of Matster X for each master. Additionally, for this type of installation, endpoints should be specified on the Settings page. On-Premises-Add Cluster-Master Configuration
  16. If necessary, expand the Advanced Options and set them.

  17. Scroll to the Instance Group section (default name group1).

  18. Specify the parameters of the worker node(s) in your group as described below.

  19. Select Installation Type:

    • Automated using SSH: for this type, set User Name, SSH Key Name and required number of Node Addresses.
    • Manual: for this type, set the Nodes parameter. Additionally, for this type of installation, endpoints should be specified on the Settings page. On-Premises-Add Cluster-Instance Group Configuration
  20. If necessary, set your own name for the instance group.

    Note You can also clone or delete the current instance group, or add another one. Instance Group-Operations

  21. Optionally, click the FEATURES step.

  22. If necessary, add features to your cluster, specifying parameters under:

    • Ingress Controller
    • Self-Hosted Logging
    • Self-Hosted Monitoring On-Premises-Add Cluster-Features Configuration
  23. If necessary, expand the Advanced Options and set them.

  24. Click the REVIEW & CREATE step.

  25. Review your cluster parameters.

  26. At the bottom of the dialog, click CONFIRM AND INSTALL.

    A notification is displayed “Your cluster is being created. It might take a few minutes.”

  27. In the notification window, click OK.

    Your new cluster page is displayed on the Events tab showing the cluster creation progress.

  28. Open Terminal and login to the master node machine with ssh:

ssh <user_name>@192.168.31.201

After you login to the machine you may need to change current user to root:

sudo -i

Insert the instruction copied earlier in command line:

curl 'http://192.168.99.106:9080/api/install/5a7a04dc7556e10001193f82/download?nodeGroup=master&nodeOrdinal=0' -o ./kublr-install.sh; chmod a+x ./kublr-install.sh; ./kublr-install.sh

You will see the following message for login Masters setup script

Enter the username and password of the user you are logged into Kublr Demo/Installer Masters setup script

At the end you will see Masters setup script

  1. In Kublr Demo/Installer UI Master Node status should be OK Masters Status
  2. Copy the instructions for Worker Node and do the same as for Master Node worker nodes script

Open Terminal and login to the worker node ssh:

ssh <user_name>@192.168.31.204

After you login to the machine you may need to change current user to root:

sudo -i

Insert the instruction copied earlier in command line:

curl 'http://192.168.99.106:9080/api/install/5a7a04dc7556e10001193f82/download?nodeGroup=default' -o ./kublr-install.sh; chmod a+x ./kublr-install.sh; ./kublr-install.sh

Enter the username and password of the user. You will be logged into Kublr and should wait until the installation is complete worker nodes Complete

Go into the Kublr UI and wait until cluster is switched to running status:

On-premises cluster is Running

kubectl

Install and Configure kubectl

For detailed instuctions, see the Install and Set Up kubectl article in Kubernetes documentation.

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

Copy Kublr config file

To retrieve config from Kublr */:

  1. Click on the cluster in the cluster list to access the cluster details page.
  2. From the overview tab, download the config file.
mkdir ~/.kube
cp ~/Downloads/config.yaml ~/.kube/config
kubectl cluster-info

Helm

Install and use Helm to deploy WordPress to your cluster

Install Helm. Click here for detailed guidelines.

For Mac users:

curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
chmod +x get_helm.sh
./get_helm.sh --version v3.12.3

For Windows users:

  1. Download Helm version 3.12.3 from here.
  2. Extract helm-v3.12.3-windows-amd64.zip to the directory where kubectl is saved.

Install WordPress

By default both WordPress and MariaDB require support for Persistent Volume storage provisioner. Configuration of that goes beyond the scope of the Quickstart, so install Wordpress with persistence disabled. Also, for on-premises installation, use Service with Type = NodePort.

Note: Additional configuration parameters for WordPress and MariaDB are available. See wordpress and mariadb documentation respectively.

helm install bitnami/wordpress --generate-name --set persistence.enabled=false,serviceType=NodePort,mariadb.persistence.enabled=false
export SERVICE_PORT=$(kubectl get svc --namespace default wordpress-wordpress -o jsonpath='{.spec.ports[?(@.name=="http")].nodePort}')
export SERVICE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
echo http://$SERVICE_IP:$SERVICE_PORT/admin
echo Username: user
echo Password: $(kubectl get secret --namespace default wordpress-wordpress -o jsonpath='{.data.wordpress-password}' | base64 --decode)

Open the browser and navigate to the URL from console output.

Congratulations! You have just deployed your first app in a Kubernetes cluster with Kublr.

See Also