banner



How To Install Kubernetes On Vmware

Deploying Kubernetes (k8s) on vSphere 7 with Tanzu Kubernetes Filigree (TKG)

TKG Deployment setup on vCenter 7.0.one.00100 via Workload Direction

Installing Tanzu Kubernetes Filigree (TKG)

Right, outset things first. Visit the TKG download page. Its important that you download the following packages advisable for your client platform (we'll be using Linux):

  • VMware Tanzu Kubernetes Grid 1.2.0 CLI
    tkg is used to install, manage and upgrade the Kubernetes cluster running on top vCenter.
  • VMware Tanzu Kubernetes Filigree i.ii.0 OVAs for Kubernetes
    In order to deploy the TKG. The setup requires the Photon container image photon-3-v1.17.3_vmware.ii.ova. Used for both the workers and management VMs.
  • Kubectl i.nineteen.1 for VMware Tanzu Kubernetes Filigree one.two.0
    kubectl is a command line tool used to administer your Kubernetes cluster from the command line.
  • VMware Tanzu Kubernetes Grid Extensions Manifest 1.two.0
    Additional services, configuration and RBAC changes that are practical to your cluster post installation.

Prerequisites

The following setups are using Ubuntu Linux. Notes will be added for additional platforms.

Installing kubectl

With the "VMware Tanzu Kubernetes Grid one.ii.0 CLI" annal downloaded. Merely extract the archive and install the tkg binary into your arrangement or user PATH. If you lot're using Mac OSX you can use the same control below just substitute darwin for linux.

          wget https://download2.vmware.com/software/TKG/1.2.0/kubectl-linux-v1.xix.one-vmware.2.gz
gunzip kubectl-linux-v1.nineteen.1-vmware.2.gz
sudo mv kubectl-mac-v1.19.1-vmware.two /usr/local/bin/kubectl
sudo chmod +x /usr/local/bin/kubectl

Installing docker

Docker is required as the TKG installer spins upwards several docker containers used to connect to and configure the remote vCenter server and its subsequent VMs.

          sudo apt-go update
sudo apt-get install apt-ship-https \
ca-certificates curlicue gnupg-agent software-properties-common
roll -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add together -
sudo apt-primal fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [curvation=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
          sudo usermod -aG docker <your-user>        

Installing Tanzu (tkg)

The Tanzu tkg is a binary application used to install, upgrade and manage your Kubernetes cluster on top of VMware vSphere.

          wget https://download2.vmware.com/software/TKG/1.two.0/tkg-darwin-amd64-v1.two.0-vmware.1.tar.gz
tar -zxvf tkg-linux-amd64-v1.2.0-vmware.one.tar.gz
cd tkg
sudo mv tkg-linux-amd64-v1.2.0+vmware.1 /usr/local/bin/tkg
sudo chmod +x /usr/local/bin/tkg

Importing the OVA images

From the hosts and clusters view, if you correct click on your Information-center you'll see the choice "Deploy OVF template" select the OVA downloaded from the vmware TKG downloads page. Nosotros're using photon-3-v1.17.3_vmware.2.ova . Then just follow the on screen steps.

Optional prerequisites

Yous many also choose to configure a defended network and or resource puddle for your k8s cluster. This can exist washed directly from the vSphere web UI. If you're configuring a new network delight ensure nodes deployed to that network will receive an IP accost via DHCP and connect to the internet.

Installing Tanzu Kubernetes Filigree

Once all the prerequisites are met launch the tkg spider web installer:

          tkg init --ui        

The Tanzu Kubernetes Filigree installation screen.

TKG installation setup.
          cat .ssh/id_rsa.pub        
          ssh-keygen -t rsa -C "your@email.com"        

Choosing the cluster instance types for vSphere Kubernetes

Managing the resources for your Kubernetes cluster.

Defining the Tazu network resources.

Choosing the photon OVA for deployment.

Configuration review your the Tanzu Kubernetes cluster

Our deploy Tanzu cluster

Configuring kubectl

We at present need to configure the kubectl (used to deploy pods and interact with the Kubernetes cluster) control to use our new cluster as our primary context (shown past the asterisk). Take hold of the cluster credentials with:

          tkg get credentials zercurity          Credentials of workload cluster 'zercurity' take been saved
You lot can now access the cluster by running 'kubectl config use-context zercurity-admin@zercurity'
          kubectl config use-context zercurity-admin@zercurity        
          kubectl version
kubectl create namespace zercurity

Installing the VMware TKG extensions

VMware provides a number of helpful extensions to add monitoring, logging and ingress services for web based (HTTP/HTTPS) deployments via contour. Note that TCP/IP ingress isn't supported.

          wget https://download2.vmware.com/software/TKG/1.2.0/tkg-extensions-manifests-v1.2.0-vmware.ane.tar
gunzip tkg-extensions-manifests-v1.2.0-vmware.1.tar-two.gz
cd tkg-extensions-v1.two.0+vmware.i/
          kubectl apply -f cert-manager/*
kubectl apply -f ingress/profile/*
kubectl utilise -f monitoring/grafana/*
kubectl apply -f monitoring/prometheus/*

Configuring vSAN storage

This is the concluding stage I promise. Too critical if y'all intend on using persistent disks (persistent book claims, pvcs) along side your deployed pods. In this last part I'chiliad also bold you're using vSAN as it has native support for container volumes.

Tanzu VMware vSAN persistent book claims.
          cat <<EOF | kubectl apply -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: thin
annotations:
storageclass.kubernetes.io/is-default-class: truthful
provisioner: csi.vsphere.vmware.com
allowVolumeExpansion: truthful
parameters:
storagepolicyname: "vSAN Default Storage Policy"
EOF
          kubectl go sc          NAME            PROVISIONER   Reclaim  BINDINGMODE  EXPANSION   AGE
thin (default) csi.vsphere.. Delete Immediate true 2s
kubectl draw sc sparse
          true cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: testing
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
EOF
          kubectl go pvc          NAME     Condition  VOLUME         Chapters  Admission  STORAGECLASS  Age
testing Bound pvc-3974d60f 1Gi RWO default 6s

Upgrading Kubernetes on TKG

This is surprisingly easy using the tkg command. All you need to exercise is go the direction cluster id using the tkg get management-cluster command. And then run tkg upgrade management-cluster with your management cluster id. This will automatically update the Kubernetes command aeroplane and worker nodes.

          tkg upgrade management-cluster tkg-mgmt-vsphere-20200927183052          Upgrading management cluster 'tkg-mgmt-vsphere-20200927183052' to TKG version 'v1.2.0' with Kubernetes version 'v1.19.1+vmware.2'. Are you sure? [y/Northward]: y
Upgrading direction cluster providers...
Checking cert-managing director version...
Deleting cert-manager Version="v0.11.0"
Installing cert-manager Version="v0.16.1"
Waiting for cert-director to exist available...
Performing upgrade...
Deleting Provider="cluster-api" Version="" TargetNamespace="capi-system"
Installing Provider="cluster-api" Version="v0.iii.ten" TargetNamespace="capi-organisation"
Deleting Provider="bootstrap-kubeadm" Version="" TargetNamespace="capi-kubeadm-bootstrap-system"
Installing Provider="bootstrap-kubeadm" Version="v0.three.10" TargetNamespace="capi-kubeadm-bootstrap-organization"
Deleting Provider="control-plane-kubeadm" Version="" TargetNamespace="capi-kubeadm-command-airplane-system"
Installing Provider="command-plane-kubeadm" Version="v0.iii.10" TargetNamespace="capi-kubeadm-control-plane-system"
Deleting Provider="infrastructure-vsphere" Version="" TargetNamespace="capv-system"
Installing Provider="infrastructure-vsphere" Version="v0.vii.one" TargetNamespace="capv-system"
Direction cluster providers upgraded successfully...
Upgrading management cluster kubernetes version...
Verifying kubernetes version...
Retrieving configuration for upgrade cluster...
Create InfrastructureTemplate for upgrade...
Upgrading command plane nodes...
Patching KubeadmControlPlane with the kubernetes version v1.xix.1+vmware.2...
Waiting for kubernetes version to be updated for control plane nodes
Upgrading worker nodes...
Patching MachineDeployment with the kubernetes version v1.19.1+vmware.ii...
Waiting for kubernetes version to be updated for worker nodes...
updating 'metadata/tkg' addition...
Management cluster 'tkg-mgmt-vsphere-20200927183052' successfully upgraded to TKG version 'v1.2.0' with kubernetes version 'v1.19.one+vmware.2'

All finished

Congratulations, you've now got a Kubernetes cluster up and running on top of your VMware cluster. In the next mail we'll be looking at deploying PostgreSQL into our cluster fix for our instance of Zercurity.

Source: https://zercurity.medium.com/deploying-kubernetes-k8s-on-vsphere-7-with-tanzu-kubernetes-grid-tkg-b9f8b8c2031e

Posted by: mcminnforperfatim.blogspot.com

0 Response to "How To Install Kubernetes On Vmware"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel