LogoLogo
HI GIO User Guide VN
HI GIO User Guide VN
  • Trung tâm trợ giúp HI GIO Cloud
    • HI GIO Cloud Website
    • HI GIO Cloud Sales Portfolio
  • COMPUTE
    • 1. Thao tác với VM
      • Tạo máy ảo mới từ ISO
      • Tạo máy ảo mới từ Template
      • Cài đặt VMware Tools cho máy ảo
      • Xem VM
      • Thực hiện các thao tác nguồn trên máy ảo
      • Chỉnh sửa các thuộc tính của máy ảo mới
      • Tạo VM's Template
      • Buộc thay đổi mật khẩu root/administrator
      • ​Xóa đĩa an toàn trong hệ điều hành Windows
    • 2. Thao tác với vAPP
      • Tạo vAPP
      • Cấu hình thứ tự khởi động và tắt máy của VM trong vApp
    • 3. HI GIO Auto Scale
    • 4. HI GIO API
      • API tạo VM từ Template
      • API cấu hình lại Disk của VM
      • API cấu hình lại Network của VM
      • API đăng nhập bằng Token
      • API cấu hình lại Memory của VM
      • API cấu hình lại CPU của VM
      • API bật/tắt nguồn VM
    • 5. HI GIO KMS Service
    • 6. Encryption Management Service
  • HI GIO S3 STORAGE
    • Đăng nhập vào HI GIO S3 Storage Portal
    • Cách lấy S3 Key
    • Mount HI GIO S3 Storage vào Windows
    • Quản lý Bucket
      • Cách tạo Bucket mới
      • Cài đặt Public hoặc Private ACL cho Bucket
      • Versioning
      • Lifecycle Rule
      • Bucket Policy
    • Quản lý Tệp, Thư mục
      • Tạo thư mục
      • Tải lên thư mục/tệp
      • Tải xuống thư mục/tệp
      • Lấy liên kết tải xuống của tệp
      • Quản lý phiên bản tệp
    • Kết nối dịch vụ S3 với Veeam Backup
      • Kết nối HI GIO S3 với Veeam Backup
    • Sao lưu dữ liệu từ NAS lên dịch vụ HI GIO S3
      • Sao lưu dữ liệu từ Synology NAS với ClouSync
      • Sao lưu dữ liệu từ Synology NAS với Hyper Backup
    • Mã hóa dữ liệu S3 – SSE-C và SSE-S3
  • BACK-UP AS A SERVICE
    • 1. HI GIO BaaS
      • BaaS Support Matrix
      • Cài đặt Veeam Agent cho Linux
      • Cài đặt Veeam Agent cho Windows
      • Cập nhật Veeam Service Provider Console Management Agent v.7 & Backup Agent v.6
      • Tạo backup job trên hệ điều hành Linux qua Veeam agent console
      • Tạo backup job trên hệ điều hành Windows qua Veeam agent console
      • Tạo backup job cho Linux qua Portal
      • Tạo backup job cho Windows qua Portal
      • Khôi phục Linux VM trên HIGIO Cloud qua tệp Media (ISO file)
      • Khôi phục Windows VM trên HI GIO Cloud qua tệp Media (ISO file)
      • Cách cấu hình nhận cảnh báo từ BaaS
      • Workaround
        • Cài đặt Veeam Agent cho CentOS 9 Stream
        • Cài đặt Veeam Agent cho CentOS 8 Stream
        • Cài đặt Veeam Agent cho RHEL 9.2
    • 2. HI GIO Backup
      • Khôi phục toàn bộ VM qua cổng vCD
      • Instant Recovery
    • 3. HI GIO M365 BaaS
  • HI GIO DRaaS
    • Cách Cài Đặt vCDA Trên On-Premises appliance
    • Cách Sử Dụng vCDA trên On-Premises
    • Stretching layer 2 networks cho HI GIO's DRaaS
      • Chuẩn bị cấu hình
      • Triển khai NSX Autonomous Edge (on-premises site).
      • Đăng ký và cấu hình mạng của NSX Autonomous Edge tại site on-premises.
      • Tạo L2 VPN server session (HI GIO site).
      • Tạo L2 VPN - Client session (on-premises site)
      • (Tùy chọn) Triển khai NSX Autonomous Edge thứ hai ở chế độ HA (on-premises site).
    • KỊCH BẢN FAILOVER
      • ENVIRONMENT
      • FAILOVER
        • Bước 1: Tạo protection job (từ site On-Premises).
        • Bước 2: Cấu hình Network Settings cho On-Premises to Cloud Replications
        • Bước 3P: - Partial failover VMs (VM - APP1) từ on-premise site to HI GIO site.
        • Bước 3F: - Full failover vAPP1 (VM - APP1 & VM - DB1) từ on-premise site to HI GIO
        • Bước 4: Sao chép ngược (reverse replication) của máy ảo từ site HI GIO Cloud về On-Premises.
        • Bước 5: Di chuyển các máy ảo từ site HI GIO Cloud về On-Premises.
        • Bước 6: Tái bảo vệ các máy ảo từ On-Premises đến HI GIO Cloud.
        • FAQs
  • NETWORK
    • 1. Làm việc với mạng (Network)
      • Quản lý Organization VDC Networks
      • Tạo NAT Rules trên Edge Gateway
      • Sử dụng Edge Gateway Firewall
      • Sử dụng Distributed Firewall trong Data Center Group
    • 2. VPN
      • IPSec parameters
      • IPSec VPN
      • Hướng dẫn cấu hình IPSec Remote Access VPN Clients trên Windows
    • 3. Load Balancer
      • Import SSL Certificate
      • Tạo Pool trong Load Balancing
      • Tạo Virtual Service (VS) trên Load Balancing
      • Mở Firewall Rule để Public Service ra Internet
      • Giám sát Traffic Analytics
      • Cách sử dụng WAF trên HI GIO Portal
  • MANAGEMENT
    • 1. IAM Portal
      • Kích hoạt tài khoản HI GIO - IAM
      • HI GIO Portal – Tenant User Guide
      • Cài Đặt Thời Gian Hết Hạn Mật Khẩu
      • Cài đặt Passkey
      • Giám sát Máy Ảo HI GIO
      • Cảnh Báo Giám Sát HI GIO - Kênh Thông Báo qua Email
      • Cảnh Báo Giám Sát HI GIO - Kênh Thông Báo qua Telegram
    • 2. Tạo Catalog
  • HI GIO Kubernetes
    • 1. Các bước tạo Kubernetes Cluster trên HI GIO Portal
    • 2. Cách thay đổi kích thước Kubernetes Cluster trên HI GIO Portal
    • 3. Mở rộng dung lượng đĩa cho các node trong Kubernetes Cluster trên HI GIO Portal
    • 4. Cách nâng cấp Kubernetes Cluster trên HI GIO Portal
    • 5. Triển khai ứng dụng demo với persistence volume và public app qua ingress controller
    • 6. Cách cấu hình autoscale Kubernetes Cluster trên HI GIO Portal
Powered by GitBook
On this page
  • Tổng quan
  • Quy trình
Export as PDF
  1. HI GIO Kubernetes

6. Cách cấu hình autoscale Kubernetes Cluster trên HI GIO Portal

Previous5. Triển khai ứng dụng demo với persistence volume và public app qua ingress controller

Last updated 4 months ago

Tổng quan

Hướng dẫn từng bước về cách cấu hình tự động mở rộng cluster Kubernetes HI GIO.

  • Cài đặt tanzu-cli

  • Tạo cluster-autoscaler deployment từ tanzu package sử dụng tanzu-cli

  • Kích hoạt tự động mở rộng cho cluster của bạn

  • kiểm tra tự động mở rộng cluster

  • Xóa cluster-autoscaler deployment và dọn dẹp tài nguyên thử nghiệm.

Quy trình

  • Bastion Ubuntu có thể kết nối với Kubernetes cluster của bạn.

  • Có quyền truy cập vào Kubernetes cluster của bạn.

1

Bước 1: Cài đặt tanzu-cli

#Install tanzu-cli to ubuntu
sudo apt update
sudo apt install -y ca-certificates curl gpg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://storage.googleapis.com/tanzu-cli-installer-packages/keys/TANZU-PACKAGING-GPG-RSA-KEY.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/tanzu-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/tanzu-archive-keyring.gpg] https://storage.googleapis.com/tanzu-cli-installer-packages/apt tanzu-cli-jessie main" | sudo tee /etc/apt/sources.list.d/tanzu.list
sudo apt update
sudo apt install -y tanzu-cli
#Verify tanzu-cli installation
tanzu version

Để cài đặt tanzu-cli trên môi trường khác, tham khảo tài liệu dưới đây:

(Tùy chọn) Nếu bạn muốn định cấu hình hoàn thành tanzu, vui lòng chạy lệnh bên dưới và làm theo hướng dẫn đầu ra

tanzu completion --help

2

Bước 2: Tạo deployment cluster-autoscaler từ gói tanzu bằng tanzu-cli

  • Chuyển sang context Kubernetes của bạn

kubectl config use-context <your context name>
  • Liệt kê các phiên bản cluster-autoscaler có sẵn trong gói tanzu và ghi lại tên phiên bản

tanzu package available list cluster-autoscaler.tanzu.vmware.com
  • Tạo secret kubeconfig có tên cluster-autoscaler-mgmt-config-secret trong namespace kube-system

kubectl create secret generic cluster-autoscaler-mgmt-config-secret \
--from-file=value=<path to your kubeconfig file> \
-n kube-system

Không thay đổi tên secret (cluster-autoscaler-mgmt-config-secret) và namespace (kube-system).

  • Tạo file cluster-autoscaler-values.yaml

arguments:
  ignoreDaemonsetsUtilization: true
  maxNodeProvisionTime: 15m
  maxNodesTotal: 0 #Leave this value as 0. We will define the max and min number of nodes later.
  metricsPort: 8085
  scaleDownDelayAfterAdd: 10m
  scaleDownDelayAfterDelete: 10s
  scaleDownDelayAfterFailure: 3m
  scaleDownUnneededTime: 10m
clusterConfig:
  clusterName: "demo-autoscale-tkg" #adjust here
  clusterNamespace: "demo-autoscale-tkg-ns" #adjust here
paused: false

Giá trị bắt buộc:

  • clusterName: Tên cluster của bạn

  • clusterNamespace: Tên cluster namespace của bạn

  • Cài đặt cluster-autoscaler

tanzu package install cluster-autoscaler \
--package cluster-autoscaler.tanzu.vmware.com \
--version <version available> \ #adjust the version listed above to match your kubernetes version
--values-file 'cluster-autoscaler-values.yaml' \
--namespace tkg-system #please do not change, this is default namespace for tanzu package

Cluster-autoscaler sẽ được triển khai vào namespace kube-system.

Chạy lệnh dưới đây để xác minh việc triển khai cluster-autoscaler:

kubectl get deployments.apps -n kube-system cluster-autoscaler

  • Cấu hình số lượng node tối thiểu và tối đa trong cluster

    • Lấy tên và namespace của machinedeployments

kubectl get machinedeployments.cluster.x-k8s.io -A
  • Cấu hình cluster-api-autoscaler-node-group-min-size and cluster-api-autoscaler-node-group-max-size

kubectl annotate machinedeployment <machinedeployment name> cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size=<number min> -n <machinedeployment namespace>
kubectl annotate machinedeployment <machinedeployment name> cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size=<number max> -n <machinedeployment namespace>
  • Bật cluster autoscale cho cluster của bạn

Vì bước này cần có sự cho phép của nhà cung cấp để thực hiện nên vui lòng thông báo cho cloud provider để thực hiện bước này.

3

Bước 3: Kiểm tra tự động mở rộng cluster

  • Lấy số lượng node hiện tại

kubectl get nodes

Hiện tại chỉ có một worker node.

  • Tạo file test-autoscale.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  namespace: default
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
      topologySpreadConstraints: #Spreads pods across different nodes (ensures no node has more pods than others)
      - maxSkew: 1 
        topologyKey: kubernetes.io/hostname
        whenUnsatisfiable: DoNotSchedule
        labelSelector:
          matchLabels:
            app: nginx
  • Áp dụng file test-autoscale.yaml để triển khai 2 replicas nginx pod trong namespace default (lệnh này sẽ kích hoạt tạo một worker node mới)

kubectl apply -f test-autoscale.yaml
  • Kiểm tra deployment nginx

kubectl get pods
kubectl describe pod nginx-589656b9b5-mcm5j | grep -A 10 Events

Bạn sẽ thấy một nginx pod mới với trạng thái Pending và các sự kiện hiển thị FailedScheduling và TriggeredScaleUp:

Warning  FailedScheduling  2m53s  default-scheduler   0/2 nodes are available: 1 node(s) didn't match pod topology spread constraints, 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }. preemption: 0/2 nodes are available: 1 No preemption victims found for incoming pod, 1 Preemption is not helpful for scheduling.
Normal   TriggeredScaleUp  2m43s  cluster-autoscaler  pod triggered scale-up: [{MachineDeployment/demo-autoscale-tkg-ns/demo-autoscale-tkg-worker-node-pool-1 1->2 (max: 5)}]
  • Chờ một chút và bạn sẽ thấy một worker node mới đã được cấp phát và nginx pod mới có trạng thái Running.

  • Dọn dẹp tài nguyên thử nghiệm

kubectl delete -f test-autoscale.yaml

Sau khi xóa deployment nginx thử nghiệm, cluster sẽ chờ vài phút để xóa node không cần thiết (tham khảo giá trị scaleDownUnneededTime trong file cluster-autoscaler-values.yaml).

  • Xóa deployment cluster-autoscaler (Tùy chọn)

Nếu bạn không muốn cluster của mình tự động mở rộng nữa, có thể xóa deployment cluster-autoscaler bằng tanzu-cli:

tanzu package installed delete cluster-autoscaler -n tkg-system -y
Installing and Using VMware Tanzu CLI v1.5.x