VMware Tanzu Community Edition 是一个功能齐全、易于管理的 Kubernetes 平台,供学习者和用户使用。 它是一个免费的、社区支持的、开源的 VMware Tanzu 发行版,可以在几分钟内在您的本地工作站或您喜欢的云上安装和配置。
VMware Tanzu社区版初体验
VMware Tanzu社区版
VMware Tanzu Community Edition 是一个功能齐全、易于管理的 Kubernetes 平台,供学习者和用户使用。 它是一个免费的、社区支持的、开源的 VMware Tanzu 发行版,可以在几分钟内在您的本地工作站或您喜欢的云上安装和配置。
Linux Local Bootstrap Machine Prerequisites
1、检查cgroup
linux-mint-002@linux-mint-002:~/tanzu$ sudo docker info | grep -i cgroup
Cgroup Driver: cgroupfs
Cgroup Version: 1
如果 cgroups v2,需要设置 system.unified_cgroup_hierarchy=0
2、下载tanzu CLI
linux-mint-002@linux-mint-002:~/tanzu$ wget http://192.168.100.18:1234/tce-linux-amd64-v0.9.1.tar.gz
linux-mint-002@linux-mint-002:~/tanzu$ tar -zxf tce-linux-amd64-v0.9.1.tar.gz
linux-mint-002@linux-mint-002:~/tanzu$ ls
tce-linux-amd64-v0.9.1 tce-linux-amd64-v0.9.1.tar.gz
linux-mint-002@linux-mint-002:~/tanzu$ cd tce-linux-amd64-v0.9.1/
linux-mint-002@linux-mint-002:~/tanzu/tce-linux-amd64-v0.9.1$ ls
bin install.sh uninstall.sh
3、运行install.sh安装
linux-mint-002@linux-mint-002:~/tanzu/tce-linux-amd64-v0.9.1$ ./install.sh
+ ALLOW_INSTALL_AS_ROOT=
+ [[ 1000 -eq 0 ]]
+++ dirname ./install.sh
++ cd .
++ pwd
+ MY_DIR=/home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1
++ uname
+ BUILD_OS=Linux
+ case "${BUILD_OS}" in
+ XDG_DATA_HOME=/home/linux-mint-002/.local/share
+ echo /home/linux-mint-002/.local/share
/home/linux-mint-002/.local/share
++ command -v tanzu
+ TANZU_BIN_PATH=
+ [[ -n '' ]]
+ TANZU_BIN_PATH=/usr/local/bin
+ [[ :/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: == *\:\/\h\o\m\e\/\l\i\n\u\x\-\m\i\n\t\-\0\0\2\/\b\i\n\:* ]]
+ echo Installing tanzu cli to /usr/local/bin
Installing tanzu cli to /usr/local/bin
+ sudo install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu /usr/local/bin
+ mkdir -p /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-builder /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-cluster /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-conformance /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-diagnostics /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-kubernetes-release /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-login /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-management-cluster /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-package /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-pinniped-auth /home/linux-mint-002/.local/share/tanzu-cli
+ for plugin in "${MY_DIR}"/bin/tanzu-plugin*
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/bin/tanzu-plugin-standalone-cluster /home/linux-mint-002/.local/share/tanzu-cli
+ mkdir -p /home/linux-mint-002/.local/share/tce
+ install /home/linux-mint-002/tanzu/tce-linux-amd64-v0.9.1/uninstall.sh /home/linux-mint-002/.local/share/tce
+ TANZU_PLUGIN_CACHE=/home/linux-mint-002/.cache/tanzu/catalog.yaml
+ [[ -n /home/linux-mint-002/.cache/tanzu/catalog.yaml ]]
+ echo 'Removing old plugin cache from /home/linux-mint-002/.cache/tanzu/catalog.yaml'
Removing old plugin cache from /home/linux-mint-002/.cache/tanzu/catalog.yaml
+ rm -f /home/linux-mint-002/.cache/tanzu/catalog.yaml
+ tanzu init
| initializing ✔ successfully initialized CLI
++ tanzu plugin repo list
++ grep tce
+ TCE_REPO=
+ [[ -z '' ]]
+ tanzu plugin repo add --name tce --gcp-bucket-name tce-tanzu-cli-plugins --gcp-root-path artifacts
++ tanzu plugin repo list
++ grep core-admin
+ TCE_REPO=
+ [[ -z '' ]]
+ tanzu plugin repo add --name core-admin --gcp-bucket-name tce-tanzu-cli-framework-admin --gcp-root-path artifacts-admin
+ echo 'Installation complete!'
Installation complete!
4、下载kubectl
curl -LO https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
5、创建集群
需要你的资源满足如下要求
6 GB of RAM
15 GB of local machine disk storage for images
4 CPUs
Local Docker Bootstrapping
1、初始化Tanzu 安装接口
linux-mint-002@linux-mint-002:~/tanzu/tce-linux-amd64-v0.9.1$ tanzu management-cluster create --ui -b 192.168.100.66:8080
Validating the pre-requisites...
Serving kickstart UI at http://192.168.100.66:8080
unable to open browser: exit status 3
2、现在可以打开链接,通过浏览器安装配置集群了
3、首先我们部署一个管理集群到docker环境
4、最后点击部署,即可开始创建一个管理集群,也可以用最底下的命令行执行
5、等待部署完成,验证管理集群是否正常
linux-mint-002@linux-mint-002:~/tanzu$ tanzu management-cluster get
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES
tanzu tkg-system running 1/1 1/1 v1.21.2+vmware.1 management
Details:
NAME READY SEVERITY REASON SINCE MESSAGE
/tanzu True 6d23h
├─ClusterInfrastructure - DockerCluster/tanzu True 6d23h
├─ControlPlane - KubeadmControlPlane/tanzu-control-plane True 6d23h
│ └─Machine/tanzu-control-plane-v9jxw True 6d23h
└─Workers
└─MachineDeployment/tanzu-md-0
└─Machine/tanzu-md-0-567d7cf787-wkphp True 6d23h
Providers:
NAMESPACE NAME TYPE PROVIDERNAME VERSION WATCHNAMESPACE
capd-system infrastructure-docker InfrastructureProvider docker v0.3.23
capi-kubeadm-bootstrap-system bootstrap-kubeadm BootstrapProvider kubeadm v0.3.23
capi-kubeadm-control-plane-system control-plane-kubeadm ControlPlaneProvider kubeadm v0.3.23
capi-system cluster-api CoreProvider cluster-api v0.3.23
6、获取管理集群的kubeconfig
linux-mint-002@linux-mint-002:~/tanzu$ tanzu management-cluster kubeconfig get tanzu --admin
然后就可以执行kubectl操作管理集群了
linux-mint-002@linux-mint-002:~/tanzu$ kubectl get no
NAME STATUS ROLES AGE VERSION
tanzu-control-plane-v9jxw Ready control-plane,master 6d23h v1.21.2+vmware.1-360497810732255795
tanzu-md-0-567d7cf787-wkphp Ready <none> 6d23h v1.21.2+vmware.1-360497810732255795
7、创建工作负载集群
linux-mint-002@linux-mint-002:~/tanzu$ tanzu cluster create tkg-workload --plan dev
linux-mint-002@linux-mint-002:~/tanzu$ tanzu cluster list
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES PLAN
tkg-workload default running 1/1 1/1 v1.21.2+vmware.1 <none> dev
8、获取工作集群的kubeconfig,并查看集群信心
linux-mint-002@linux-mint-002:~/tanzu$ tanzu cluster kubeconfig get tkg-workload --admin
linux-mint-002@linux-mint-002:~/tanzu$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* tanzu-admin@tanzu tanzu tanzu-admin
tkg-workload-admin@tkg-workload tkg-workload tkg-workload-admin
切换kubecontext
linux-mint-002@linux-mint-002:~/tanzu$ kubectl config use-context tkg-workload-admin@tkg-workload
Switched to context "tkg-workload-admin@tkg-workload".
linux-mint-002@linux-mint-002:~/tanzu$ kubectl get no
NAME STATUS ROLES AGE VERSION
tkg-workload-control-plane-nbddz Ready control-plane,master 6d2h v1.21.2+vmware.1-360497810732255795
tkg-workload-md-0-c7bc5dc9f-zwjfg Ready <none> 6d2h v1.21.2+vmware.1-360497810732255795
linux-mint-002@linux-mint-002:~/tanzu$ kubectl get po --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system antrea-agent-xwrk6 2/2 Running 1 6d2h
kube-system antrea-agent-zl6gq 2/2 Running 0 6d2h
kube-system antrea-controller-89547f7f5-tgn7z 1/1 Running 0 6d2h
kube-system coredns-8dcb5c56b-lbcqw 1/1 Running 0 6d2h
kube-system coredns-8dcb5c56b-wvzjw 1/1 Running 0 6d2h
kube-system etcd-tkg-workload-control-plane-nbddz 1/1 Running 0 6d2h
kube-system kube-apiserver-tkg-workload-control-plane-nbddz 1/1 Running 0 6d2h
kube-system kube-controller-manager-tkg-workload-control-plane-nbddz 1/1 Running 0 6d2h
kube-system kube-proxy-226wj 1/1 Running 0 6d2h
kube-system kube-proxy-hwq2q 1/1 Running 0 6d2h
kube-system kube-scheduler-tkg-workload-control-plane-nbddz 1/1 Running 0 6d2h
kube-system metrics-server-b9698ff4-rhrw5 1/1 Running 0 6d2h
projectcontour contour-c48db6f9f-dmcfb 1/1 Running 0 6d2h
projectcontour contour-c48db6f9f-zwszk 1/1 Running 0 6d2h
projectcontour contour-certgen-v1.18.1-zfcwr 0/1 Completed 0 6d2h
projectcontour envoy-n6pld 2/2 Running 0 6d2h
tkg-system kapp-controller-74bcf9f866-9f6th 1/1 Running 0 6d2h
tkg-system tanzu-capabilities-controller-manager-6ff97656b8-bbhs6 1/1 Running 0 6d2h
以上,为tanzu社区版的安装,更多信息参见官方文档