Create a small Kubernetes cluster on hourly plans, connect to it with kubectl, and delete it when
you have finished. You need:
- A TIR project.
- An Active VPC with a subnet in the same project and region. If you need one, create a VPC first.
- A role that lets you create Kubernetes clusters in the project, such as Project Lead. See Roles and permissions.
- On a prepaid account, enough credit for the plans you pick.
kubectlon your own machine. See the Kubernetes install guide.
Create the cluster
Section titled “Create the cluster”- In TIR, open your project. In the side menu, under PRODUCTS, select Kubernetes.
- Select Create Cluster.
- Under Cluster details, keep the name TIR suggests, which starts with
k8s-cluster, or type your own. Leave Kubernetes version on the version chosen for you, the newest one on offer. - Under Control plane configuration, choose 1 node for Number of nodes. One node is enough for a cluster you are trying out; for a cluster you depend on, keep 3 nodes. TIR has already chosen a CPU resource on its On-Demand plan, which bills by the hour, so leave it.
- Under Worker configuration, select Add your first worker node pool. Keep the suggested Pool name, leave Number of nodes at 1, and keep the CPU resource and its On-Demand plan. Check Estimated pool cost, then select Add node pool.
- Under Cluster network, choose your VPC in VPC.
- Check the estimated costs in Cluster summary, then select Create Cluster. If your account runs on unverified free credit, confirm first: tick the box and select Submit.
Cluster storage is set up for you: every cluster comes with a default StorageClass for ReadWriteOnce volumes.
TIR queues the cluster and opens its details page. The status moves through Queued, Cluster Provisioning, Worker Joining, and briefly Worker Joined, to Ready. Provisioning usually takes 10 to 30 minutes.
Download the kubeconfig
Section titled “Download the kubeconfig”Once the status is Worker Joined or Ready, select Download kubeconfig at the top of the
details page. Your browser saves a file named after the cluster, ending in -kubeconfig.yaml.
The kubeconfig gives full administrative access to the cluster. Guard it as you would a private key, and keep it out of repositories and chat messages.
Run your first kubectl command
Section titled “Run your first kubectl command”In a terminal on your machine, list the cluster’s nodes. Replace the path with the path of the file you downloaded:
kubectl --kubeconfig ~/Downloads/<cluster-name>-kubeconfig.yaml get nodesThe output lists the control plane node and the worker node, and each one shows Ready in the
STATUS column once it has joined. That answer comes from the cluster’s API server, so every other
kubectl command works the same way.
Delete the cluster when you finish
Section titled “Delete the cluster when you finish”The control plane is billed from when it is ready until you delete the cluster. Each worker node is billed by the hour while it is up and ready. Delete a test cluster as soon as you are done with it, so that the charges stop. You need the delete permission on Kubernetes.
Deleting a cluster removes its control plane, every pool and node, its storage and the volumes on it, and its kubeconfig. Deleting is permanent, so copy out anything you want to keep first.
- In Manage Kubernetes Cluster, open the cluster’s Actions menu and select Delete Cluster.
- Tick the box that confirms you want to delete the cluster, and select Delete Cluster.
TIR queues the deletion. The cluster is Deleting, then leaves the list.
What to do next
Section titled “What to do next”- Create a Kubernetes cluster explains every choice on the form, including three control plane nodes, committed plans, more pools, and node labels and taints.
- Connect to a Kubernetes cluster shows how to set the
KUBECONFIGvariable so you can drop the--kubeconfigflag. It also shows how to deploy a first app. - Expose services with a load balancer puts a Service on a public reserved IP.
If the cluster ends at Failed or kubectl cannot reach it, see
Troubleshooting TIR Kubernetes.