VMware Tanzu Kubernetes 集群部署

目录:

  1. 创建Content Libraries
  2. 为Tanzu Kubernetes集群创建NameSpace
  3. 准备Tanzu Kubernetes集群YAML文件
  4. 创建Tanzu Kubernetes集群
  5. 登陆Tanzu Kubernetes集群

 

前提条件:

  1. Tanzu Kubernetes集群是基于vSphere with Kubernetes环境之上的,因此需要准备好vSphere with Kubernetes环境。

  2. vCenter Server必须可以上网,因为需要和VMware服务器同步Photon K8S系统镜像。

 

1. 创建Content Libraries

在Inventories中点击 “Content Libraries”

New Content Library,输入名称 Kubernetes

选择Subscribed content library,URL为 https://wp-content.vmware.com/v2/latest/lib.json

选择存储

点击Finish。

 

创建完成后,可以在Templates页面中查看到正在同步的photon k8s镜像文件(因为文件有11.71GB,因此同步时间可能从几分钟至几小时)。

 

将创建好的Content Library和Cluster进行关联。

 

2. 为Tanzu Kubernetes集群创建NameSpace

右击vSphere with Kubernetes集群,选择 New Namespace

输入名称和描述,点击Create

 

为创建好的namespace指派用户和存储

 

3. 准备Tanzu Kubernetes集群YAML文件

apiVersion: run.tanzu.vmware.com/v1alpha1      # TKG API endpoint,固定值
kind: TanzuKubernetesCluster                   # Required parameter,固定值
metadata:
  name: tkc-guest-cluster
  namespace: tkc-cluster               # 在vSphere中创建的NameSpace
spec:
  distribution:
    version: v1.16.8+vmware.1-tkg.3.60d2ffd
  topology:
    controlPlane:
      count: 3                                 # 3 control plane nodes
      class: guaranteed-medium                 # medium size VM
      storageClass: vk8s                       # vSphere中创建的存储策略,跟vSphere with kubernetes需要的存储策略类似
    workers:
      count: 3                                 # 3 worker nodes
      class: guaranteed-medium                 # medium large size VM
      storageClass: vk8s                       # vSphere中创建的存储策略,跟vSphere with kubernetes需要的存储策略类似
  settings:
    network:
      cni:
        name: calico                # 目前仅支持Calico
      services:
        cidrBlocks: ["198.51.100.0/12"]        # Cannot overlap with Supervisor Cluster
      pods:
        cidrBlocks: ["192.0.2.0/16"]           # Cannot overlap with Supervisor Cluster
    storage:
      classes: ["vk8s"]                      # vSphere中创建的存储策略,跟vSphere with kubernetes需要的存储策略类似,可以指定多个。
      defaultClass: vk8s                     # vSphere中创建的存储策略,跟vSphere with kubernetes需要的存储策略类似

虚机类型配置参数

CPU内存 (GB)存储 (GB)预留的 CPU 和内存
guaranteed-xlarge43216
best-effort-xlarge43216
guaranteed-large41616
best-effort-large41616
guaranteed-medium2816
best-effort-medium2816
guaranteed-small2416
best-effort-small2416
guaranteed-xsmall2216
best-effort-xsmall2216

 

4. 创建Tanzu Kubernetes集群

登陆vsphere with kubernetes集群,切换context,查看virtualmachineimages(注意:如果virtualmachineimages显示为空,则表示Content Library还没有同步完成)

创建Tanzu KUbernetes集群(yaml文件内容见第三步)

 等30分钟左右后Tanzu Kubernetes集群创建完成

查看Tanzu Kubernetes集群中的VirtualMachine

 在vCenter Server中查看

 

5. 登陆Tanzu Kubernetes集群

登陆命令

kubectl vsphere login  --server https://xxxx --insecure-skip-tls-verify \
--tanzu-kubernetes-cluster-namespace tkc-cluster \
--tanzu-kubernetes-cluster-name tkc-guest-cluster \
--vsphere-username administrator@vsphere.local

登录成功后,切换到Tanzu Kubernetes集群

 

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值