在vSphere 7 with K8S的整体架构中,Tanzu Kubernetes集群是完全由开发人员建立/维护/销毁。运维人员无法从wcp的控制平台对其进行操作。同时,Tanzu Kubernetes集群还可以用于多租户场景。
有关Tanzu Kubernetes集群的备置(建立),请参考vSphere 7 Kubernetes 初体验中的:使用 Tanzu Kubernetes Grid 服务置备Tanzu Kubernetes 集群。
首先,我们还是对vSphere 7 with K8S的整体逻辑视图进行复习:
我们可以看到,Tanzu Kubernetes集群存在于Superior Namespace内。
继续使用上一篇vSphere 7 Kubernetes 初体验中备置的Tanzu Kubernetes集群。
1.改变yaml文件,弹性扩容Tanzu Kubernetes集群。
[root@localhost ~]# cat tz-cluster.yaml
apiVersion: run.tanzu.vmware.com/v1alpha1 #TKG API endpoint
kind: TanzuKubernetesCluster #required parameter
metadata:
name: tkg-cluster-vmlab #cluster name, user defined
namespace: ns-tkg #supervisor namespace
spec:
distribution:
version: v1.16 #resolved kubernetes version
topology:
controlPlane:
count: 3 #number of control plane nodes
class: guaranteed-small #vmclass for control plane nodes
storageClass: wcp-policy #storageclass for control plane
workers:
count: 4 #number of worker nodes
class: guaranteed-small #vmclass for worker nodes
storageClass: wcp-policy #storageclass for worker nodes
将controlPlane的数量改为3,worker的数量改为4.
应用以后,从vCenter的界面可以看到:
值得注意的是,在集群名字旁,指名了该集群的管理:开发人员管理。
如我们想在Tanzu Kubernetes集群进行缩容,将controlPlane的数量改为1,worker的数量改为3,执行之后:
[root@localhost ~]# kubectl apply -f tz-cluster.yaml
Error from server (control plane scale-in not supported, worker scale-in not supported): error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"run.tanzu.vmware.com/v1alpha1\",\"kind\":\"TanzuKubernetesCluster\",\"metadata\":{\"annotations\":{},\"name\":\"tkg-cluster-vmlab\",\"namespace\":\"ns-vpods\"},\"spec\":{\"distribution\":{\"version\":\"v1.16\"},\"topology\":{\"controlPlane\":{\"class\":\"guaranteed-small\",\"count\":1,\"storageClass\":\"wcp-normal\"},\"workers\":{\"class\":\"guaranteed-small\",\"count\":3,\"storageClass\":\"wcp-normal\"}}}}\n"}},"spec":{"topology":{"controlPlane":{"count":1},"workers":{"count":3}}}}
to:
Resou