The Tanzu Kubernetes Grid bundle includes the Tanzu Kubernetes Grid CLI binaries and cluster plans from which Tanzu Kubernetes Grid deploys clusters. Tanzu Kubernetes Grid also provides the base OS images from which node VMs are created, that include the supported versions of Kubernetes and Cluster API.
To use Tanzu Kubernetes Grid, you download and run the Tanzu Kubernetes Grid CLI on a local system, known as the bootstrap environment. The bootstrap environment is the laptop, host, or server on which the initial bootstrapping of a management cluster is performed. This is where you run Tanzu Kubernetes Grid CLI commands. Tanzu Kubernetes Grid creates a temporary management cluster using a Kubernetes in Docker (
kind
) cluster on the bootstrap environment. After creating the temporary management cluster locally, Tanzu Kubernetes Grid uses it to provision the final management cluster in the platform of your choice.- Install the Tanzu Kubernetes Grid CLI Binary
Prerequisites
Google Kubernetes
Tanzu Kubernetes Grid provides CLI binaries for Linux and Mac OS systems.
The bootstrap environment on which you run the Tanzu Kubernetes Grid CLI must meet the following requirements:
- If you intend to use the Tanzu Kubernetes Grid installer interface, a browser is available. You can use the Tanzu Kubernetes Grid CLI without a browser, but for first deployments it is strongly recommended to use the installer interface.
kubectl
is installed.- Docker is installed and running, if you are installing Tanzu Kubernetes Grid on Linux platforms.
- Docker Desktop is installed and running, if you are installing Tanzu Kubernetes Grid on Mac OS platforms.
- System time is synchronized with a Network Time Protocol (NTP) server.
If you are running Docker Desktop on Mac OS, the
kind
container requires at least 6GB of RAM. For information about how to configure Docker Desktop so that it can run kind
, see Settings for Docker Desktop in the kind
documentation.Docker is used to create, manage, and run our containers. It lets us construct containers that will run in Kubernetes Pods. Install VirtualBox for Mac using Homebrew. Run brew cask install virtualbox in your Terminal. VirtualBox lets you run virtual machines on your Mac (like running Windows inside macOS, except for a Kubernetes cluster.).
- While you at the CodeReady Containers downloads page, go ahead and download the pull secret; the button is just a bit further down the page. This will be used for authentication the first time you start your Kubernetes (OpenShift, actually) cluster. It looks like this: Prove it. The command crc version should yield.
- If you need to install a new copy of Docker for Mac you can download it from the Docker Store. Edge channel required Kubernetes support is still considered experimental with this release, so to enable the download and use of Kubernetes components you must be on the Edge channel.
- The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. For a complete list of kubectl operations, see Overview of kubectl.
- Kubectl is a command line tool for controlling Kubernetes clusters, we install this on the host (Mac) and use it to control and interact with the Kubernetes cluster we will be running inside the Minikube VM. Minikube is a tool that runs a single-node Kubernetes cluster in a virtual machine on your personal computer. We’re using this to.
NOTE: If you have previously used Cluster API on the machine that you are using as your bootstrap environment, you must delete the
~/.cluster-api
folder from that machine. This folder contains configuration files that might interfere with the correct interoperation of Cluster API and Tanzu Kubernetes Grid.Download and Unpack the Tanzu Kubernetes Grid Bundle
- Go to https://www.vmware.com/go/get-tkg and log in with your My VMware credentials.
- Download the Tanzu Kubernetes Grid CLI to the machine to use as the bootstrap environment.
- For Linux platforms, download
tkg-linux-amd64-v1.0.0_vmware.1.gz
. - For Mac OS platforms, download
tkg-darwin-amd64-v1.0.0_vmware.1.gz
.
- For Linux platforms, download
- Use either the
gunzip
command or the extraction tool of your choice to unpack the binaries. Run either one of the following commands:The unpacked files aretkg-linux-amd64
ortkg-darwin-amd64
.
Install the Tanzu Kubernetes Grid CLI Binary
![Download Kubernetes For Mac Download Kubernetes For Mac](/uploads/1/2/9/4/129402750/715928262.jpg)
After you have downloaded and unpacked the Tanzu Kubernetes Grid CLI binary to your bootstrap environment, you must make it available to the system.
- Navigate to the executable for the Tanzu Kubernetes Grid CLI.
- Rename the CLI binary for your platform to
tkg
, make sure that it is executable, and add it to yourPath
.- Move the binary into the
/usr/local/bin
folder and rename it totkg
. - Make the file executable.
- Move the binary into the
- At the command line in a new terminal, run
tkg
to see help for the full list of commands and options that the Tanzu Kubernetes Grid CLI provides. - Run
tkg version
to check that the correct version of the binary is properly installed.You should see information about the installed Tanzu Kubernetes Grid CLI version. - Run
tkg --help
to see the list of commands that the Tanzu Kubernetes Grid CLI provides.You can run any command with the--help
option to see information about that specific command or sub-command. For example,tkg init --help
ortkg create cluster --help
.If you are running on Mac OS, you might encounter the following error:If this happens, you need to create a security exception for thetkg
executable. Locate thetkg
app in Finder, control-click the app, and select Open.
CLI Short Names and Aliases
Most of the Tanzu Kubernetes Grid CLI commands and options have short names or aliases, so that you do not have to type the full command and option names each time you run
tkg
. For example, -h
for --help
, and mc
for management-cluster
. For increased clarity, this documentation always uses the full command and option names. To see the shortnames and aliases for commands and options, run CLI commands with the --help
option.Common Tanzu Kubernetes Grid Options
The Tanzu Kubernetes Grid CLI provides common options that can be used with all of the CLI commands.
Option | Description |
---|---|
--config | The path to the management cluster configuration file, if it is not stored in the default location, $HOME/.tkg/config.yaml . For example, tkg init --ui --config=/path/my-config.yaml . |
--help | Show help for the current command. For example, tkg create cluster --help . |
--kubeconfig | The path to the kubeconfig file for the management cluster, if it is not stored in the default location. |
--log_file | Specify a file in which to save the logs for the current command. For example, tkg scale cluster my-cluster --worker-machine-count=9 --log_file=my-cluster-scale-logs . |
--quiet | Mute all output for the current command. |
--v | Set the logging verbosity level for the command. |
What to Do Next
The Tanzu Kubernetes Grid CLI is ready to use. You can use the Tanzu Kubernetes Grid installer interface or CLI to deploy a management cluster to either vSphere or Amazon EC2.
If you have vSphere 7.0 and the vSphere with Kubernetes feature is enabled, you can directly use the Tanzu Kubernetes Grid CLI to deploy Tanzu Kubernetes clusters to vSphere with Kubernetes. For information about how to connect the Tanzu Kubernetes Grid CLI to a vSphere with Kubernetes Supervisor Cluster, see Use the Tanzu Kubernetes Grid CLI with a vSphere with Kubernetes Supervisor Cluster .
Recently I tried to setup Kubernetes and Istio on my Mac machine. I have captured the steps I used.
We are going to do the following,
- Install Docker for Mac
- Enable Kubernetes in Docker engine
- Setup Kubernetes dashboard
- Install Istio
- Set up the sample booking app from Istio samples
Install Docker for mac
First get Docker for Mac. This comes with an experimental feature to run Kubernetes. So head over to dockerhub site (might require signing) and download the dmg file. Download and install the file.
Once Docker is installed, open it. Docker start up wizard will run through steps which requires admin credentials. Provide them and continue. You will have to login to docker hub to have docker running.
Click the whale icon on the desktop and select preferences. Make check box selection as in the image below.
Click Advanced and Make sure you run at 4 CPU and 6 GB memory. This is required to run Istio.
Click Apply and Restart. This will restart the instance and you should see both “Docker Engine is running” and “Kubernetes is running” (It takes a while first time as Kubernetes setup will download all the images required for it to run).
Running “docker images” will return following Kubernetes images.
Setup Kubernetes Dashboard
We will setup Kubernetes Dashboard. It is a neat web UI, which can be used to monitor Kubernetes.
This should start the Kubernetes dashboard at localhost. Launch it using the url – http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login
Create a file “dashboard-adminuser.yaml” with the following content.
And run the following commands,
Copy the entire token from the above command’s output. This is going to be the dashboard login.
Click Sign in and you should see the dashboard.
Installing Istio
Now, download Istio from the site. and cd into the Istio installation folder.
Once extracted, copy the PATH export and run it in your terminal so that Istio bin directory is in your PATH.
At this point, you have Docker with Kubernetes installed. And Istio is available in your machine. Let’s configure Istio now.
Execute the following command to see the Services
Now, run the following command to check if all the pods are running.
This could take a while. IF you see the pods stuck at not getting to running state, you may have to see if the memory is set to 6 GB (as the mentioned in one of the previous step). Otherwise, it should look something like below.
Enable Istio injection setting and proceed with the sample application setup.
At this point, Kubernetes and Istio is installed and the sample app is also running. It can be tested by running the url – http://localhost/productpage in browser. This should bring up the Simple bookinfo sample app. Refreshing the page will show different ratings as Istio is routing the traffic to 3 versions of reviews in round robin basis.
Next steps
Download Kubernetes
As a next step, try to do some advanced routing with the links below.