Files
k3s/009-基础设施/007-keda/deploy.sh
2026-02-05 00:11:05 +08:00

41 lines
891 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# KEDA 部署脚本
echo "开始部署 KEDA..."
# 设置 KUBECONFIG
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
# 添加 KEDA Helm 仓库
echo "添加 KEDA Helm 仓库..."
helm repo add kedacore https://kedacore.github.io/charts
helm repo update
# 创建命名空间
echo "创建 keda 命名空间..."
kubectl create namespace keda --dry-run=client -o yaml | kubectl apply -f -
# 安装 KEDA
echo "安装 KEDA..."
helm install keda kedacore/keda \
--namespace keda \
-f values.yaml
# 等待 KEDA 组件就绪
echo "等待 KEDA 组件启动..."
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=keda-operator -n keda --timeout=300s
# 显示状态
echo ""
echo "KEDA 部署完成!"
kubectl get pods -n keda
kubectl get svc -n keda
echo ""
echo "验证 KEDA CRD"
kubectl get crd | grep keda
echo ""
echo "KEDA 已成功部署到命名空间: keda"