In last post of this series, I covered TKG management cluster setup. In this post we will learn how to deploy TKG workload/compute/kubernetes cluster.
If you have missed earlier post of this series, you can read them from below links:
2: TKG Management Cluster Deployment
Before attempting to deploy TKG workload cluster, ensure you are connected to management cluster context. If you are not already connected to the context, you can use command kubectl config use-context <mgmt-cluster-context-name> to connect to the same.
Step 1: Create a new namespace
An example json file is located in kubernetes official website which I have used to create a test namespace for me. You can create your own json if you want.
# kubectl create -f https://kubernetes.io/examples/admin/namespace-dev.json
Step 2: Create yaml file for workload cluster deployment.
# tkg config cluster mj-tkgc01 –plan dev –controlplane-machine-count 1 –worker-machine-count 3 –namespace development –controlplane-size small –worker-size small > dev.yaml
Step 3: Create Workload Cluster
# tkg create cluster mj-tkgc01 –manifest dev.yaml
1 2 3 4 5 6 7 8 |
Logs of the command execution can also be found at: /tmp/tkg-20200825T192608346824416.log Validating configuration... Creating workload cluster 'mj-tkgc01'... Waiting for cluster to be initialized... Waiting for cluster nodes to be available... Workload cluster 'mj-tkgc01' created |
Step 4: Get Workload Cluster Credential
# tkg get credentials my-cluster –namespace=my-namespace
Example:
1 2 3 4 |
root@tkg-client:~# tkg get credentials mj-tkgc01 --namespace development Credentials of workload cluster 'mj-tkgc01' have been saved You can now access the cluster by running 'kubectl config use-context mj-tkgc01-admin@mj-tkgc01' |
Step 5: Use workload cluster context
root@tkg-client:~# kubectl config use-context mj-tkgc01-admin@mj-tkgc01
Switched to context “mj-tkgc01-admin@mj-tkgc01”.
Step 6: Fetch workload cluster node details
1 2 3 4 5 6 7 |
root@tkg-client:~# kubectl get nodes NAME STATUS ROLES AGE VERSION mj-tkgc01-control-plane-rnbr4 Ready master 18h v1.18.3+vmware.1 mj-tkgc01-md-0-585557b45c-qf7mm Ready <none> 18h v1.18.3+vmware.1 mj-tkgc01-md-0-585557b45c-sbn8z Ready <none> 18h v1.18.3+vmware.1 mj-tkgc01-md-0-585557b45c-smcf9 Ready <none> 18h v1.18.3+vmware.1 |
We can clearly see that there is one control-plane node and 3 worker nodes and all are in ready state.
And that completes workload cluster deployment. We are now ready to deploy applications on top of kubernetes. Stay tuned for part 4 of this series !!!!!
I hope you enjoyed reading the post. Feel free to share this on social media if it is worth sharing 🙂