我有一个 Keda 部署,我已经尝试开始工作大约一个月了。目前,我的缩放器看起来像这样:
apiVersion: keda.k8s.io/v1alpha1
kind: ScaledObject
metadata:
name: {service-name}-scaler
spec:
scaleTargetRef:
deploymentName: {service-name}
containerName: {service-name}
pollingInterval: 30
cooldownPeriod: 600
minReplicaCount: 0
maxReplicaCount: 10
triggers:
- type: aws-sqs-queue
authenticationRef:
name: keda-trigger-authentication
metadata:
queueURL: https://sqs.ap-northeast-1.amazonaws.com/{AWS ID}/{Queue-name}
queueLength: "1"
awsRegion: "ap-northeast-1"
identityOwner: pod
关联的触发器身份验证和机密是:
apiVersion: v1
kind: Secret
metadata:
name: keda-secrets
data:
AWS_ACCESS_KEY_ID: {base64-encoded-string}
AWS_SECRET_ACCESS_KEY: {base64-encoded-string}
KEDA_ROLE_ARN: {base64-encoded-string}
---
apiVersion: keda.k8s.io/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-trigger-authentication
spec:
env:
- parameter: awsRegion
name: AWS_REGION
- parameter: awsAccessKeyID
name: AWS_ACCESS_KEY_ID
- parameter: awsSecretAccessKey
name: AWS_SECRET_ACCESS_KEY
- parameter: awsRoleArn
name: KEDA_ROLE_ARN
secretTargetRef:
- parameter: awsRoleArn
name: keda-secrets
key: KEDA_ROLE_ARN
我知道KEDA_ROLE_ARN
这里重复了这个值;我出于调试目的都离开了。部署顺序如下:
- 安装通用环境变量(这是
AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
和KEDA_ROLE_ARN
值的存储位置。AWS_ACCESS_KEY_ID
和AWS_SECRET_ACCESS_KEY
值在文件中分别列为AWS_ACCESS_KEY_ID_ASSUME
和AWS_SECRET_ACCESS_KEY_ASSUME
,并将在容器上假定它们的适当值。同样,这些重复用于调试目的。我更喜欢使用这些值而不是单独的秘密。使用 Helm 安装 Keda pod - 部署 keda-secrets secret 和 keda-trigger-authentication trigger authentication
- 部署应该扩展的容器。这是
AWS_ACCESS_KEY_ID_ASSUME
值将采用的名称AWS_ACCESS_KEY_ID
和AWS_SECRET_ACCESS_KEY_ASSUME
值将采用的名称AWS_SECRET_ACCESS_KEY
和AWS_REGION
定义值的位置。 - 已部署缩放对象
出于某种原因,当缩放器尝试缩放时,我不断收到来自 AWS 的错误,说链中没有凭证提供者。似乎没有发送 AWS 凭证。我在这里做错了什么?