Search This Blog

Tuesday 11 February 2020

Taking VMware Tanzu Mission Control for a test drive this time creating a k8s cluster on AWS

Previously I blogged about how to use VMware Tanzu Mission Control (TMC) to attach to kubernetes clusters and in that example we used a GCP GKE cluster. That blog entry exists here

Taking VMware Tanzu Mission Control for a test drive
http://theblasfrompas.blogspot.com/2020/02/taking-tanzu-mission-control-for-test.html

In this example we will use the "Create Cluster" button to create a new k8s cluster on AWS that will be managed by TMC for it's entire lifecycle.

Steps

Note: Before getting started you need to create a "Cloud Provider Account" and that is done using AWS as shown below. You can create one or more connected cloud provider accounts. Adding accounts allows you to start using VMware TMC to create clusters, add data protection, and much more



1. Click on the "Clusters" on the left hand navigation bar

2. In the right hand corner click the button "New Cluster" and select your cloud provider account on AWS as shown below


3. Fill in the details of your new cluster as shown below ensuring you select the correct AWS region where your cluster will be created.



4. Click Next

5. In the next screen I am just going to select a Development control plane



6. Click Next

7. Edit the default-node-pool and add 2 worker nodes instead of just 1 as shown below



8. Click "Create"

9. This will take you to a screen where your cluster will create. This can take at least 20 minutes so be patient. Progress is shown as per below



10. If we switch over to AWS console we will start to see some running instances and other cloud components being created as shown in the images below




11. Eventually the cluster will create and you are taken to a summary screen for your cluster. It will take a few minutes for all "Agent and extensions health" to show up green so refresh the page serval times until all shows up green as per below.

Note: This can take up to 10 minutes so be patient




12. So to access this cluster using "kubectl" use the button "Access this Cluster" in the top right hand corner and it will take you to a screen as follows. Click the "Download kubeconfig file" and the "Tanzu Mission Control CLI" as you will need both those files and save them locally



13. make the "tmc" CLI executable and save to your $PATH as shown below

$ chmod +x tmc
$ sudo mv tmc /usr/local/bin

14. Access cluster using "kubectl" as follows
  
  $ kubectl --kubeconfig=./kubeconfig-pas-aws-cluster.yml get namespaces
  NAME                STATUS   AGE
  default             Active   19m
  kube-node-lease     Active   19m
  kube-public         Active   19m
  kube-system         Active   19m
  vmware-system-tmc   Active   17m

Note: You will be taken to a web page to authenticate and once that's done your good to go as shown below


15. You can view the pods created to allows access from the TMC agent as follows
  
$ kubectl --kubeconfig=./kubeconfig-pas-aws-cluster.yml get pods --namespace=vmware-system-tmc
NAME                                     READY   STATUS      RESTARTS   AGE
agent-updater-7b47c659d-8h2mh            1/1     Running     0          25m
agentupdater-workload-1581415620-csz5p   0/1     Completed   0          35s
data-protection-769994df65-6cgfh         1/1     Running     0          24m
extension-manager-657b467c-k4fkl         1/1     Running     0          25m
extension-updater-c76785dc9-vnmdl        1/1     Running     0          25m
inspection-extension-79dcff47f6-7lm5r    1/1     Running     0          24m
intent-agent-7bdf6c8bd4-kgm46            1/1     Running     0          24m
policy-sync-extension-8648685fc7-shn5g   1/1     Running     0          24m
policy-webhook-78f5699b76-bvz5f          1/1     Running     1          24m
policy-webhook-78f5699b76-td74b          1/1     Running     0          24m
sync-agent-84f5f8bcdc-mrc9p              1/1     Running     0          24m

So if you got this far you now have attached a cluster and created a cluster from scratch all from VMware TMC and that's just the start.

Soon I will show to add some policies to our cluster now we have them under management

More Information

Introducing VMware Tanzu Mission Control to Bring Order to Cluster Chaos
https://blogs.vmware.com/cloudnative/2019/08/26/vmware-tanzu-mission-control/

VMware Tanzu Mission Control
https://cloud.vmware.com/tanzu-mission-control

Taking VMware Tanzu Mission Control for a test drive

You may or may not have heard of Tanzu Mission Control (TMC) part of the new VMware Tanzu offering which will help you build, run and manage modern apps. To find out more about Tanzu Mission Control here is the Blog link on that.

https://blogs.vmware.com/cloudnative/2019/08/26/vmware-tanzu-mission-control/

In this blog I show you how easily you can use TMC to monitor your existing k8s clusters. Keep in mind TMC can also create k8s clusters for you but here we will use the "Attach Cluster" part of TMC. Demo as follows

1. Of course you will need access account on TMC which for this demo I already have. Once logged in you will see a home screen as follows



2. In the right hand corner there is a "Attach Cluster" button click this to attach an existing cluster to TMC. Enter some cluster details , in this case I am attaching to a k8s cluster on GKE and giving it a name "pas-gke-cluster".


3. Click the "Register" button which takes you to a screen which allows you to install the VMware Tanzu Mission Control agent. This is simply done by using "kubectl apply ..." on your k8s cluster which allows an agent to communicate back to TMC itself. Everything is created in a namespace called "vmware-system-tmc"



4. Once you have run the "kubectl apply .." on your cluster you can verify the status of the pods and other components installed as follows

$ kubectl get all --namespace=vmware-system-tmc

Or you could just check the status of the various pods as shown below and assume everything else was created ok
  
$ kubectl get pods --namespace=vmware-system-tmc
NAME                                     READY   STATUS      RESTARTS   AGE
agent-updater-67bb5bb9c6-khfwh           1/1     Running     0          74m
agentupdater-workload-1581383460-5dsx9   0/1     Completed   0          59s
data-protection-657d8bf96c-v627g         1/1     Running     0          73m
extension-manager-857d46c6c-zfzbj        1/1     Running     0          74m
extension-updater-6ddd9858cf-lr88r       1/1     Running     0          74m
inspection-extension-789bb48b6-mnlqj     1/1     Running     0          73m
intent-agent-cfb49d788-cq8tk             1/1     Running     0          73m
policy-sync-extension-686c757989-jftjc   1/1     Running     0          73m
policy-webhook-5cdc7b87dd-8shlp          1/1     Running     0          73m
policy-webhook-5cdc7b87dd-fzz6s          1/1     Running     0          73m
sync-agent-84bd6c7bf7-rtzcn              1/1     Running     0          73m

5. Now at this point click on "Verify Connection" button to confirm the agent in your k8s cluster is able to communicate with TMC

6. Now let's search for out cluster on the "Clusters" page as shown below



7. Click on "pas-gke-cluster" and you will be taken to an Overview page as shown below. Ensure all green tick boxes are in place this may take a few minutes so refresh the page as needed



8. So this being an empty cluster I will create a deployment with 2 pods so we can see how TMC shows this workload in the UI. These "kubectl commands" should work on any cluster as the image is on Docker Hub

$ kubectl run pbs-deploy --image=pasapples/pbs-demo-image --replicas=2 --port=8080
$ kubectl expose deployment pbs-deploy --type=LoadBalancer --port=80 --target-port=8080 --name=pbs-demo-service

9. Test the workload (Although this isn't really required)

$ echo "http://`kubectl get svc pbs-demo-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}'`/customers/1"
http://104.197.202.165/customers/1

$ http http://104.197.202.165/customers/1
HTTP/1.1 200
Content-Type: application/hal+json;charset=UTF-8
Date: Tue, 11 Feb 2020 01:43:26 GMT
Transfer-Encoding: chunked

{
    "_links": {
        "customer": {
            "href": "http://104.197.202.165/customers/1"
        },
        "self": {
            "href": "http://104.197.202.165/customers/1"
        }
    },
    "name": "pas",
    "status": "active"
}

10. Back on the TMC UI click on workloads. You should see our deployment as per below


11. Click on the deployment "pbs-deploy" to see the status of the pods created as part of the deployment replica set plus the YAML of the deployment itself


12. Of course this is just scratching the surface but from the other tabs you can see the cluster nodes, namespaces and other information as required not just for your workloads but also for the cluster itself




One thing to note here is when I attach a cluster as shown in this demo the life cycle of the cluster, for example upgrades, can't be managed / performed by TMC. In the next post I will show how "Create Cluster" will actually be able to control the life cycle of the cluster as well as this time TMC will actually create the cluster for us.

Stay tuned!!!

More Information

Introducing VMware Tanzu Mission Control to Bring Order to Cluster Chaos
https://blogs.vmware.com/cloudnative/2019/08/26/vmware-tanzu-mission-control/

VMware Tanzu Mission Control
https://cloud.vmware.com/tanzu-mission-control