(可选)在 Amazon EKS 中将 Amazon AppConfig 作为 DaemonSet 运行
使用 Amazon EKS,可以将 Amazon AppConfig 代理作为 sidecar 运行,这会导致每个应用程序容器组(pod)都有一个代理容器。或者,如果您愿意,也可以将 Amazon AppConfig 代理作为 DaemonSet
注意
如果您将 Amazon AppConfig 代理作为 DaemonSet 运行,则代理将在单独的容器组(pod)中运行,这意味着您无法通过调用 localhost 来访问它。您必须注入或以其它方式发现代理容器组(pod)的 IP 地址,才能调用它。
要将 Amazon AppConfig 代理作为 DaemonSet 运行,请创建一个包含以下内容的清单文件。将突出显示的 文本替换为应用程序和环境的详细信息。对于 Amazon Web Services 区域,请指定 Amazon Web Services 区域代码(例如,us-west-1)。
apiVersion: apps/v1 kind: DaemonSet metadata: name: aws-appconfig-agent namespace:my_namespacelabels: app:my_application_labelspec: selector: matchLabels: app:my_application_labeltemplate: metadata: labels: app:my_application_labelspec: containers: - name: aws-appconfig-agent image: public.ecr.aws/aws-appconfig/aws-appconfig-agent:2.x ports: - name: http containerPort: 2772 protocol: TCP env: - name: SERVICE_REGION value:Amazon Web Services 区域imagePullPolicy: IfNotPresent # set a high priority class to ensure the agent is running on every node priorityClassName: system-node-critical
运行以下命令以将 Amazon AppConfig 代理 DaemonSet 应用于集群。将 aws_appconfig_agent_daemonset 替换为 DaemonSet 清单的名称。
kubectl apply -faws_appconfig_agent_daemonset.yml