作者:ezmsp易云服科技公有云架构师雷凯栋
给EKS配置Cloudwatch Container Insight Service account,并且启用Cloudwatch Container Insight
编辑create_cluster.yaml文件
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-test03
region: cn-north-1
version: "1.22"
vpc:
clusterEndpoints:
publicAccess: true
privateAccess: true
kubernetesNetworkConfig:
serviceIPv4CIDR: 10.50.0.0/24
managedNodeGroups:
- name: managed-ng
labels:
Name: managed-ng
instanceType: m5.2xlarge
minSize: 3
desiredCapacity: 3
maxSize: 6
volumeType: gp3
volumeSize: 100
tags:
nodegroup-name: ng1
iam:
withAddonPolicies:
imageBuilder: true
autoScaler: true
certManager: true
efs: true
albIngress: true
xRay: true
cloudWatch: true
cloudWatch:
clusterLogging:
enableTypes: ["api", "audit", "authenticator", "controllerManager", "scheduler"]
logRetentionInDays: 30
保存退出并执行以下命令创建集群
eksctl create cluster -f create_cluster.yaml
eksctl utils associate-iam-oidc-provider --region cn-north-1 --cluster eks-test03 --approve
eksctl create iamserviceaccount --cluster=eks-test03 --namespace=amazon-cloudwatch --name=cloudwatch-agent --attach-policy-arn=arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy --override-existing-serviceaccounts --region cn-north-1 --approve
部署配置文件(注意这一段需要Linux的bash来执行,Windows下cmd无法执行)
ClusterName=eks-test03
RegionName=cn-north-1
FluentBitHttpPort='2020'
FluentBitReadFromHead='Off'
[[ ${FluentBitReadFromHead} = 'On' ]] && FluentBitReadFromTail='Off'|| FluentBitReadFromTail='On'
[[ -z ${FluentBitHttpPort} ]] && FluentBitHttpServer='Off' || FluentBitHttpServer='On'
AWS国内地区执行:
curl https://myworkshop.bitipcman.com/eks101/cwagent-fluent-bit-quickstart-cn.yaml | sed 's/{{cluster_name}}/'${ClusterName}'/;s/{{region_name}}/'${RegionName}'/;s/{{http_server_toggle}}/"'${FluentBitHttpServer}'"/;s/{{http_server_port}}/"'${FluentBitHttpPort}'"/;s/{{read_from_head}}/"'${FluentBitReadFromHead}'"/;s/{{read_from_tail}}/"'${FluentBitReadFromTail}'"/' | kubectl apply -f -
海外地区修改以下url:
curl https://myworkshop.bitipcman.com/eks101/cwagent-fluent-bit-quickstart.yaml | sed 's/{{cluster_name}}/'${ClusterName}'/;s/{{region_name}}/'${RegionName}'/;s/{{http_server_toggle}}/"'${FluentBitHttpServer}'"/;s/{{http_server_port}}/"'${FluentBitHttpPort}'"/;s/{{read_from_head}}/"'${FluentBitReadFromHead}'"/;s/{{read_from_tail}}/"'${FluentBitReadFromTail}'"/' | kubectl apply -f -
可以在控制台通过选择某个集群的指标纬度来查看监控
更新时间:2024-08-15
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号