Update NKP using NKP cli

ในการ upgrade นี้จะใช้วิธีแบบ air gapped โดยต้อง download bundle จาก nutanix portal ด้วยการ copy Download link ของ NKP Airgapped Bundle (Version v2.15.0)

ใช้ curl ในการ download หรือ tools อื่น หรือจะ click download ก็ได้ ตัวอย่างนี้จะใช้ curl

[nutanix@harbor ~]$ curl -o nkp-air-gapped-bundle_v2.15.0_linux_amd64.tar.gz "https://download.nutanix.com/downloads/nkp/v2.15.0/nkp-air-gapped-bundle_v2.15.0_linux_amd64.tar.gz?Expires=1751840997&Key-Pair-Id=APKAJTTNCWPEI42QKMSA&Signature=MWumafkGQqAazC31HnaDyHlqfjAggj8q7c5~viJDgbJ1vb2-Xv1bHJwshl4m2gILPcf8emPtZU4VKk0sOMJ-t7lc9PopCKGhd~T1LPTt6wSJx29MEEdcvE7p3jDQZI1uuI5qflzmwaljOiwXThgiIgnIw3WcVa97a7GT3BH1O~fmg0sbiSFh1LG6lUKMCZayDwlbbSfBQA1feE8WfTolwgXNu6WMtZBn2Rl4l0bffuWVcGDGFn2ywBJSt5V5iPTU4bgjzLOqSB6E3ZkvtBZvIHqNwhrUEPJpKyTTvUZh7wbP56gU~hThlJZBOs6BkC5n6h~E0H2aohDUjUjos396XA__"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16.2G 100 16.2G 0 0 41.8M 0 0:06:36 0:06:36 --:--:-- 40.9M

ทำการ unzip file ที่ download มา

[nutanix@harbor ~]$ tar -xvf nkp-air-gapped-bundle_v2.15.0_linux_amd64.tar.gz
[nutanix@harbor ~]$ cd nkp-v2.15.0
[nutanix@harbor nkp-v2.15.0]$ ls
application-charts cli kib kubectl NOTICES
application-repositories container-images konvoy-bootstrap-image-v2.15.0.tar nkp-image-builder-image-v2.15.0.tar

push kommander container ซึ่งเป็นระบบจัดการ (nkp management) การใช้งานต่างๆ ของ NKP ไปยัง harbor internal registry

[nutanix@harbor nkp-v2.15.0]$ nkp push bundle --bundle ./container-images/kommander-image-bundle-v2.15.0.tar \
--to-registry=https://10.38.16.169/mirror \
--to-registry-username=admin \
--to-registry-password=Harbor12345 \
--to-registry-insecure-skip-tls-verify
✓ Creating temporary directory
✓ Unarchiving image bundle "./container-images/kommander-image-bundle-v2.15.0.tar"
✓ Parsing image bundle config
✓ Starting temporary Docker registry
✓ Pushing bundled images [================================>135/135] (time elapsed 53s)

push nkp convoy ซึ่งเป็น cluster life cycle management ของ nkp

[nutanix@harbor nkp-v2.15.0]$ nkp push bundle --bundle ./container-images/konvoy-image-bundle-v2.15.0.tar \
--to-registry=https://10.38.16.169/mirror \
--to-registry-username=admin \
--to-registry-password=Harbor12345 \
--to-registry-insecure-skip-tls-verify
✓ Creating temporary directory
✓ Unarchiving image bundle "./container-images/konvoy-image-bundle-v2.15.0.tar"
✓ Parsing image bundle config
✓ Starting temporary Docker registry
✓ Pushing bundled images [================================>110/110] (time elapsed 52s)

update nkp cli เป็น version 2.15 โดยการ copy workdload link และ install cli

curl -fsSL https://raw.githubusercontent.com/nutanixdev/nkp-quickstart/main/get-nkp-cli | bash

run nkp update command เพื่อ update kommander

*** ต้อง upgrade kommander ก่อนเสมอ เพราะการ upgrade nkp management cluster ด้วย version ใหม่ก่อน อาจจะส่งผลให้ kommander ทำงานมีปัญหาได้จากการเปลี่ยนแปลง version ของ kubernetes โดยที่ยังใช้ kommander version เก่าอยู่

[nutanix@harbor nkp-v2.15.0]$ nkp upgrade kommander --charts-bundle ./application-charts/nkp-kommander-charts-bundle-v2.15.0.tar.gz \
--kommander-applications-repository ./application-repositories/kommander-applications-v2.15.0.tar.gz \
--kubeconfig /home/nutanix/nkp-at-next.conf \
--request-timeout 0 \
-v 5

หลังจาก install kommander เสร็จแล้วทำการ update nkp management cluster โดยการ list cluster ทั้งหมด และใช้ nkp cli ตามตัวอย่าง

[nutanix@harbor ~]$ k get cluster -A
NAMESPACE NAME CLUSTERCLASS PHASE AGE VERSION
default nkp-at-next nkp-nutanix-v2.14.0 Provisioned 42h v1.31.4
kommander-default-workspace cluster2 nkp-nutanix-v2.14.0 Provisioned 38h v1.31.4
nkp upgrade cluster nutanix \
--cluster-name nkp-at-next \
--vm-image nkp-rocky-9.5-release-1.32.3-20250430150550.qcow2 \
--kubeconfig /home/nutanix/nkp-at-next.conf \
--timeout 0 -v 5

หลังจาก upgrade management cluster เสร็จแล้ว สามารถ upgrade workload cluster ตามด้วย nkp cli ตามตัวอย่าง

[nutanix@harbor ~]$ nkp upgrade cluster nutanix \
--cluster-name cluster2 \
--namespace kommander-default-workspace \
--vm-image nkp-rocky-9.5-release-1.32.3-20250430150550.qcow2 \
--kubeconfig /home/nutanix/nkp-at-next.conf \
--timeout 0 -v 6

ตรวจสอบว่า cluster ถูก upgrade ไปยัง version ใหม่แล้วด้วย cli

[nutanix@harbor ~]$ k get cluster -A
NAMESPACE NAME CLUSTERCLASS PHASE AGE VERSION
default nkp-at-next nkp-nutanix-v2.15.0 Provisioned 43h v1.32.3
kommander-default-workspace cluster2 nkp-nutanix-v2.15.0 Provisioned 39h v1.32.3