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社群版的安裝,更多資訊參見官方文件