vm.gowatana.jp

NEOにほんごVMware(仮)

VCF 9.0 で Foundation LB の vSphere Supervisor を構成してみる。Part-06:VKS クラスタの作成

VMware Cloud Foundation(VCF)9.0 の vCenter で、Foundation ロード バランサを使用したスーパーバイザーを有効化してみます。今回は、スーパーバイザーに vSphere Kubernetes Service(VKS)のクラスタを作成してみます。

前回はこちら。

 

今回の内容です。

 

1. vSphere 名前空間への接続

VCF CLI で、コンテキストを VKS クラスタを作成する vSphere 名前空間に切り替えます。

$ vcf context use sv-01:demo-ns-01
[ok] Token is still active. Skipped the token refresh for context "sv-01:demo-ns-01"
[i] Successfully activated context 'sv-01:demo-ns-01' (Type: kubernetes)
[i] Fetching recommended plugins for active context 'sv-01:demo-ns-01'...
[ok] All recommended plugins are already installed and up-to-date.

 

現在のコンテキストが「sv-01:demo-ns-01」に切り換えられていること(CURRENT: true)を確認します。

$ vcf context list
  NAME                         CURRENT  TYPE
  sv-01                        false    kubernetes
  sv-01:demo-ns-01             true     kubernetes
  sv-01:svc-tkg-domain-c10     false    kubernetes
  sv-01:svc-velero-domain-c10  false    kubernetes

[i] Use '--wide' to view additional columns.

 

2. 事前確認

YAML ファイルで指定するため、VKS クラスタ ノードのクローン元になる Kubernetes Release の名前を確認します。今回は「v1.30.1---vmware.1-fips-tkg.5」を使用します。

$ vcf kubernetes-release get
  NAME                                    VERSION                               TYPE    COMPATIBLE  ACTIVE
  v1.28.15---vmware.3-fips-vkr.3          v1.28.15+vmware.3-fips-vkr.3                  True        True
  v1.28.7---vmware.1-fips.1-tkg.1         v1.28.7+vmware.1-fips.1-tkg.1         Legacy  True        True
  v1.28.7---vmware.1-fips.1-tkg.1.ubuntu  v1.28.7+vmware.1-fips.1-tkg.1.ubuntu  Legacy  True        True
  v1.28.8---vmware.1-fips.1-tkg.2         v1.28.8+vmware.1-fips.1-tkg.2                 True        True
  v1.29.4---vmware.3-fips.1-tkg.1         v1.29.4+vmware.3-fips.1-tkg.1                 True        True
  v1.30.1---vmware.1-fips-tkg.5           v1.30.1+vmware.1-fips-tkg.5                   True        True
  v1.30.8---vmware.1-fips-vkr.1           v1.30.8+vmware.1-fips-vkr.1                   True        True
  v1.31.4---vmware.1-fips-vkr.3           v1.31.4+vmware.1-fips-vkr.3                   True        True
  v1.32.0---vmware.6-fips-vkr.2           v1.32.0+vmware.6-fips-vkr.2                   True        True

 

仮想マシン ストレージ ポリシーの名前の一部から、対応するStorageClass の名前を確認しておきます。

$ kubectl get storageclass | grep -i vcf-m01 vcf-m01-cl01-vsan-storage-policy csi.vsphere.vmware.com Delete Immediate true 21h vcf-m01-cl01-vsan-storage-policy-latebinding csi.vsphere.vmware.com Delete WaitForFirstConsumer true 21h

 

3. YAML ファイルの作成

今回は、VSK クラスタを定義する YMAL ファイルを下記のように作成します。

vks01.yml

gist.github.com

 

4. VKS クラスタの作成

vcf cluster create コマンドで、VKS クラスタを作成します。

$ vcf cluster create -f vks01.yml
waiting for cluster to be initialized...
[zero or multiple KCP objects found for the given cluster, 0 vks01 demo-ns-01, no MachineDeployment objects found for the given cluster]
[cluster control plane is still being initialized: ScalingUp, cluster infrastructure is still being provisioned: ScalingUp]
cluster control plane is still being initialized: ScalingUp
cluster control plane is still being initialized: WaitingForKubeadmInit
waiting for cluster nodes to be available...
waiting for addons core packages installation...

Workload cluster 'vks01' created

gowatana@vcf9-work-01 [ ~ ]$

 

これで VKS クラスタが作成されました。

$ vcf cluster list -A
  NAME   NAMESPACE   STATUS   CONTROLPLANE  WORKERS  KUBERNETES             KUBERNETESRELEASE
  vks01  demo-ns-01  running  1/1           1/1      v1.30.1+vmware.1-fips  v1.30.1---vmware.1-fips-tkg.5

 

VKS クラスタは、2台の仮想マシン(Control Plane x1、Worker x1)で構成されます。IP アドレスは、スーパーバイザーのワークロード ネットワーク(vcf-m01-cl01-vds01-pg-wl01)で設定した IP 範囲から設定されています。

 

おまけ:VKS クラスタの削除

VKS クラスタの削除にも、VCF CLI を使用します。

コンテキストを、VKS を作成してある vSphere 名前空間に切り替えます。

$ vcf context use sv-01:demo-ns-01
[ok] Token is still active. Skipped the token refresh for context "sv-01:demo-ns-01"
[i] Successfully activated context 'sv-01:demo-ns-01' (Type: kubernetes)
[i] Fetching recommended plugins for active context 'sv-01:demo-ns-01'...
[ok] All recommended plugins are already installed and up-to-date.

 

VKS クラスタの一覧を確認します。

$ vcf cluster list -A
  NAME   NAMESPACE   STATUS   CONTROLPLANE  WORKERS  KUBERNETES             KUBERNETESRELEASE
  vks01  demo-ns-01  running  1/1           1/1      v1.30.1+vmware.1-fips  v1.30.1---vmware.1-fips-tkg.5

 

「vcf cluster delete」を実行して、VKS クラスタを削除します。

$ vcf cluster delete vks01 -n demo-ns-01 -y
Workload cluster 'vks01' is being deleted

 

少し待つと、VKS クラスタが削除されます。

$ vcf cluster list -A
  NAME  NAMESPACE  STATUS  CONTROLPLANE  WORKERS  KUBERNETES  KUBERNETESRELEASE

$

 

つづく。