EKS on Fargateã§ALBããã¢ããªã«ã¢ã¯ã»ã¹ãã
éé¡çã«èªåã®è¶£å³ã§EKSãFargateã使ããã¨ã¯ãªãã®ã§ãããèå³ããã£ãã®ã§å°ã触ã£ã¦ã¿ã¾ããã
ç¾æç¹ã§ã¯ããã¥ã¡ã³ããæã£ã¦ãããã試è¡é¯èª¤ãå¿
è¦ã ã£ãã®ã§è¨äºã«æ®ãã¦ããã¾ãã
...ã¨æã£ãã®ã§ãããAWS Advent Calendarã代ããã«æ稿ã§ãããã ã£ãã®ã§7æ¥ç®ã¨ãã¦æ稿ãã¾ãã
qiita.com
ãã®è¨äºã§ç´¹ä»ããã¦ãããã¨ã¯ä»¥ä¸ã®ãªãã¸ããªã§ç°¡æ½ã«ç¢ºèªãããã¨ãã§ãã¾ãã
GitHub - 8398a7/eks-on-fargate
æ¸ãã¦ãããã¨
ä»åç´¹ä»ããå
容ã®ã¾ã¨ãã§ãã
æ¤è¨¼ã¯macOSä¸ããè¡ã£ã¦ãã¾ãã
- æ¸ãã¦ãããã¨
- ãã¼ã«ã®æºå
- ã¯ã©ã¹ã¿ã®æºå
- ALB Ingress Controllerã®ã»ããã¢ãã
- target-type: ipã®æå
- hostã®å²å½æé
- iam-for-pods
- ããã£ããã¤ã³ã
- ææ
ãã¼ã«ã®æºå
ä¸è¨ã®ããã¥ã¡ã³ããèªãã§aws-cli, kubectl, eksctlãå©ç¨ã§ããããã«ãã¦ãã ããã
eksctl の開始方法 - Amazon EKS
eksctlãæ¢ã«å
¥ã£ã¦ããå ´åã§ãfargateã¯ã©ã¹ã¿ãä½æããããã«ã¯0.11以ä¸ãå¿
è¦ã§ãã
å¿
è¦ã«å¿ãã¦brew upgradeãã¦ãã ããã
$ > eksctl version [â¹] version.Info{BuiltAt:"", GitCommit:"", GitTag:"0.11.1"}
ã¯ã©ã¹ã¿ã®æºå
eksctl create cluster poc --fargate
eksctlã§ä½æããã¨ãã®ã¯ã©ã¹ã¿ã§å©ç¨ããVPCãsubnetã®è¨å®ãè¡ã£ã¦ããã¾ãã
ä¸è¨ã§è§¦ããããã¥ã¡ã³ãã§subnet tagã«annotationãããæé ãæ¸ããã¦ãã¾ãããeksctlçµç±ã§ä½æããå ´åã¯æ¢ã«ä»ä¸ããã¦ããããä¸è¦ãªæé ã§ãã
å ·ä½çã«ã¯ä»¥ä¸ã®é¨åã§ãã
Key Value
kubernetes.io/role/elb 1
kubernetes.io/role/internal-elb 1
ã¯ã©ã¹ã¿ã®ä½æã¯å²ã¨æéããããã®ã§ãã¨ããããå©ãã¦ä»äºãããã®ããå§ãã§ãã
ã¯ã©ã¹ã¿ãä½æãããç´å¾ã¯corednsã®podãåãã¦ãããããããFargateã§åä½ãã¦ãã¾ãã
$ > kubectl get po -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-6d75bbbf58-5vhpf 1/1 Running 0 5m18s kube-system coredns-6d75bbbf58-zttkt 1/1 Running 0 5m18s $ > kubectl get node NAME STATUS ROLES AGE VERSION fargate-ip-192-168-175-13.ap-northeast-1.compute.internal Ready <none> 5m1s v1.14.8-eks fargate-ip-192-168-179-161.ap-northeast-1.compute.internal Ready <none> 5m17s v1.14.8-eks
Fargateã§åããããã«ã¯namespaceåä½ã§è¨å®ããå¿ è¦ãããã¾ãããeksctlã§ä½æããå ´åã¯default, kube-systemã®podãFargateã§èµ·åããããã«ãªã£ã¦ãã¾ãã
ä¸è¨ä»¥å¤ã®namespaceã§podãåããå ´åã¯ç¾å¨ã¯nodeãåå¨ããªãã®ã§pendingã®ã¾ã¾å¾ ãããããã¨ãã£ãæåã«ãªãã¾ãã
ALB Ingress Controllerã®ã»ããã¢ãã
å
¬å¼ããã¥ã¡ã³ã㯠ALB Ingress Controller on Amazon EKS - Amazon EKS ã§ãããEC2ã§åããåæã§æ¸ããã¦ãããFargateã®ã¿ã®æ§æã§ã¯åãã¾ããã
å
·ä½çã«ã¯Fargateã®podã§IAMã®æ¨©éã渡ãæ¹æ³ãEC2ã®å ´åã¨Fargateã®å ´åã§ç°ãªãã®ãåå ã§ãã
ä¸æ¦ç°¡æçãªæ¹æ³ã¨ãã¦alb-ingress-controllerã®Deploymentã«ç´æ¥key/secretãæ¸ãæ¹æ³ãç´¹ä»ãã¾ãã
prodã§ã¯æ¨å¥¨ããã¦ããªãæ¹å¼ãªã®ã§ãã¡ããã¨ä½¿ãå ´åã¯iam-for-podsãå©ç¨ãã¾ãããã
refs: Authentication Issues On EKS Cluster with Fargate Policy · Issue #1092 · kubernetes-sigs/aws-alb-ingress-controller · GitHub
iam-for-podsãå©ç¨ããæ¹å¼ã¯å¾è¿°ãã¾ãããä¸æ¦key/secretæ¹å¼ã§ç¶ãã¾ãã
以ä¸ã®æé ã§key/secretãåå¾ãã¾ãã
jqãå©ç¨ãã¦ããã®ã§ãäºã brew install jq
ãæ¸ã¾ãã¦ããã¦ãã ããã
# ALBãæä½ããããã®policyãä½æ curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/iam-policy.json policyArn=$(aws iam create-policy \ --policy-name ALBIngressControllerIAMPolicy \ --policy-document file://iam-policy.json | jq -r .Policy.Arn) rm iam-policy.json # ALBãæä½ããããã®key/secretæãåºãã¦ã¼ã¶ã®ä½æ aws iam create-user --user-name pocUser # å ç¨ä½æããã¦ã¼ã¶ã«ALBã®policyãç´ä»ã aws iam attach-user-policy --user-name pocUser --policy-arn $policyArn # ã¦ã¼ã¶ã®key/secretãæãåºã aws iam create-access-key --user-name pocUser
æå¾ã®ã³ãã³ãã§ä»¥ä¸ã®ãããªåºåãå¾ãããã®ã§AccessKeyIdã¨SecretAccessKeyãã¡ã¢ãã¦ããã¦ãã ããã
{ "AccessKey": { "UserName": "pocUser", "AccessKeyId": "key", "Status": "Active", "SecretAccessKey": "secret", "CreateDate": "2019-12-07T08:30:11Z" } }
ããã¾ã§æ´ã£ããrbac-roleã¨alb-ingress-controllerãdeployãã¦ããã¾ãã
rbac-roleã«é¢ãã¦ã¯ããã¥ã¡ã³ãéãã®æé ã§deployãã¾ãã
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/rbac-role.yaml
alb-ingress-controllerã«é¢ãã¦ã¯ä»¥ä¸ã®ãããªä¿®æ£ãããyamlãæå ã«ç¨æãdeployãã¦ãã ããã ä¿®æ£ç¹ã¯3ç¹ã§ãã
- vpc_idã®æå®
- keyã®æå®
- secretã®æå®
apiVersion: apps/v1 kind: Deployment metadata: labels: app.kubernetes.io/name: alb-ingress-controller name: alb-ingress-controller namespace: kube-system spec: selector: matchLabels: app.kubernetes.io/name: alb-ingress-controller template: metadata: labels: app.kubernetes.io/name: alb-ingress-controller spec: containers: - name: alb-ingress-controller image: docker.io/amazon/aws-alb-ingress-controller:v1.1.4 args: - --ingress-class=alb - --cluster-name=poc - --aws-region=ap-northeast-1 - --aws-vpc-id=vpc-xxxx # eksctlã§ä½æãããVPCã®id env: - name: AWS_ACCESS_KEY_ID value: # ãã£ãã¡ã¢ããkey - name: AWS_SECRET_ACCESS_KEY value: # ãã£ãã¡ã¢ããsecret resources: {} serviceAccountName: alb-ingress-controller
GitHubä¸ã§ã¯v1.1.4ã¿ã°ã§ãv1.1.3ã®ã¤ã¡ã¼ã¸ãå©ç¨ããããã«ãªã£ã¦ããã®ã§ãv1.1.4ã«æ¸ãæãã¦ããã¾ãã
ä¿®æ£ã§ããã以ä¸ã®ã³ãã³ãã§deployããalb-ingress-controllerãRunningã«ãªãã¾ã§å¾
ã¡ã¾ãããã
kubectl apply -f alb-ingress-controller.yaml watch -n1 kubectl get po -n kube-system
次ã«nginxãALBããã¢ã¯ã»ã¹ããããã®yamlãè¨è¿°ãã¾ãã
--- apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: nginx annotations: kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/target-type: ip labels: app: nginx spec: rules: - http: paths: - path: /* backend: serviceName: nginx servicePort: 80 --- apiVersion: apps/v1 kind: Deployment metadata: name: nginx spec: selector: matchLabels: app: nginx replicas: 1 template: metadata: labels: app: nginx spec: containers: - image: nginx name: nginx ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: nginx spec: ports: - port: 80 targetPort: 80 protocol: TCP type: ClusterIP selector: app: nginx
ãã¤ã³ã㯠alb.ingress.kubernetes.io/target-type: ip
ã®annotationsãã¤ãããã¨ã§ãã
ingressãªã½ã¼ã¹ãä½ãããã¨alb-ingress-controllerã«ä»¥ä¸ã®ãããªãã°ãåºã¾ãã
ãã°ã¯ kubectl logs -n kube-system $(kubectl get po -n kube-system -o name | grep alb | cut -d/ -f2) -f
ã§ç¢ºèªãã¦ãã ããã
default/nginx: granting inbound permissions to securityGroup sg-0c4ff2ae847363695: [{ FromPort: 80, IpProtocol: "tcp", IpRanges: [{ CidrIp: "0.0.0.0/0", Description: "Allow ingress on port 80 from 0.0.0.0/0" }], ToPort: 80 }] default/nginx: creating LoadBalancer 0d836fa6-default-nginx-ef8b
ingressã®çµæã確èªãã¦ãã©ã¦ã¶ã§ã¢ã¯ã»ã¹ãã¦ã¿ã¾ãããã
$ > kubectl get ing NAME HOSTS ADDRESS PORTS AGE nginx * 0d836fa6-default-nginx-ef8b-28953798.ap-northeast-1.elb.amazonaws.com 80 4m2s $ > open http://$(kubectl get ing -o jsonpath='{.items[].status.loadBalancer.ingress[].hostname}')
nginxã®ãã¼ã¸ã表示ã§ãããæåã§ãã
ããã¾ã§ã§èµ·åãããhostæ°ã¯4å°ã§ããã
$ > kubectl get node NAME STATUS ROLES AGE VERSION fargate-ip-192-168-111-46.ap-northeast-1.compute.internal Ready <none> 9m26s v1.14.8-eks fargate-ip-192-168-126-238.ap-northeast-1.compute.internal Ready <none> 8m4s v1.14.8-eks fargate-ip-192-168-151-139.ap-northeast-1.compute.internal Ready <none> 16m v1.14.8-eks fargate-ip-192-168-170-198.ap-northeast-1.compute.internal Ready <none> 16m v1.14.8-eks
以ä¸ã®æé ã§ãªã½ã¼ã¹ãæé¤ãã¦ãã ããã
kubectl delete -f app.yaml # nginxã®ãµã³ãã«ã¢ã㪠kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/rbac-role.yaml kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/alb-ingress-controller.yaml eksctl delete cluster poc userId=$(aws sts get-caller-identity | jq -r .UserId) aws iam delete-policy --policy-arn arn:aws:iam::${userId}:policy/ALBIngressControllerIAMPolicy
pocUserã«é¢ãã¦ã¯aws consoleããæåã§åé¤ããé¡ããã¾ãã
target-type: ipã®æå
alb.ingress.kubernetes.io/target-type: ip
ã¨ããannotationãåè¦ã ã£ãã®ã§ãã©ãããæåãªã®ãè¦ã¦ã¿ã¾ããã
LBãä½ãããéã«ã¿ã¼ã²ããã°ã«ã¼ãã種é¡: ipã§ä½ããã¦Fargate hostã®private ipãroutingããã¦ãã¾ããã
試ãã«deploymentã®replicasã1->2ã«æ´æ°ãã¦ã¿ãã¨ä»¥ä¸ã®ããã«ãã°ãåºã¦ç»é²æ¸ã¿ã¿ã¼ã²ãããèªåçã«æ´æ°ããã¦ãã¾ããã
Adding targets to arn:aws:elasticloadbalancing:ap-northeast-1:xxx:targetgroup/yyy/zzz modifying rule 1 on arn:aws:elasticloadbalancing:ap-northeast-1:xxx:listener/app/yyy/zzz default/nginx: rule 1 modified with conditions [{ Field: "path-pattern", Values: ["/*"] }]
replicasã1ã«æ»ãã¨ã¡ããã¨å¤ãã¦ããã¾ãã
default/nginx: Removing targets from arn:aws:elasticloadbalancing:ap-northeast-1:xxx:targetgroup/yyy/zzz: 192.168.147.236:80, 192.168.106.177:80 default/nginx: modifying rule 1 on arn:aws:elasticloadbalancing:ap-northeast-1:xxx:listener/app/yyy/zzz default/nginx: rule 1 modified with conditions [{ Field: "path-pattern", Values: ["/*"] }]
ãã®è¾ºã¯å½ããåã¨ã¯ããã°å½ããåã§ãããã¡ããã¨integrationããã¦ã¦è¯ãã§ããã
å®è£
ãèªãã§ããªãã§ãããtarget-type: ipã®annotationãã¤ããingressãwatchãã¦svc->deployã¾ã§è¾¿ã£ã¦replicasãç£è¦ãã¦ããã®ã§ããããã
ã¿ã¼ã²ããã°ã«ã¼ãè¨å®ãè¦ã¦ã¿ãã¨ãç»é²è§£é¤ã®é
延ãããã©ã«ã300ç§ã§ä½ããã¦ãããå¤ãããã¾ã§ã®æéå·®ãå°ãæ°ã«ãªãã¾ããã
annotationã§æå®ã§ããã®ããªãã¨èª¿ã¹ã¦ã¿ãã¨ããããã¥ã¡ã³ãã«ã¡ããã¨è¼ã£ã¦ããã試ãã¦ã¿ãã¨åæ ããã¦ãã¾ããã
default/nginx: Modifying TargetGroup arn:aws:elasticloadbalancing:ap-northeast-1:xxx:targetgroup/yyy/zzz attributes to [{ Key: "deregistration_delay.timeout_seconds", Value: "30" }]. default/nginx: modifying rule 1 on arn:aws:elasticloadbalancing:ap-northeast-1:xxx:listener/app/yyy/zzz default/nginx: rule 1 modified with conditions [{ Field: "path-pattern", Values: ["/*"] }]
alb.ingress.kubernetes.io/target-group-attributes: deregistration_delay.timeout_seconds=30
refs: Annotation - AWS ALB Ingress Controller
300ç§ã¯é·ãããçããã¨ããå ´åãã¡ããã¨è¨å®ã§ããããã«ãªã£ã¦ã¦è¯ãã§ããã
ããã§podãæ¶ããã¿ã¤ãã³ã°ã¨LBããå¤ãããã¿ã¤ãã³ã°ã¯ãããæããã«ãªã£ã¦ããã®ãã¨æã£ã¦èª¿ã¹ã¦ã¿ã¾ããã
ããã§è¨ããããæããã¨ã¯
- ã¿ã¼ã²ããã°ã«ã¼ãããå¤ãããã¾ã§podã®terminateãå¾ æ©ããã
- ã¿ã¼ã²ããã°ã«ã¼ãããå¤ããããã¨ã確èªãã¦podã®terminateãå®è¡ããã
ã¨ãããã¨ã§ãã
å®é試ãã¦ã¿ãã¨ãpodãåé¤ã¨åæã«ã¿ã¼ã²ããã°ã«ã¼ãã®åé¤å¦çãèµ°ãããã«ãªã£ã¦ãã¾ããã
ããã§ã¯å¤ãããã¾ã§ããã©ã«ãã®300ç§delayã®ã¨ãã«æ£å¸¸ã«åä½ããªãã®ã§ã¯ï¼ã¨ç¢ºããã¦ã¿ãã¨ãããä¸ç¬504 gateway timeoutãåºãæåã確èªãã¾ããã
ãã ãä¸ç¬ã ãã§ããã«200ããè¿ã£ã¦ããªããªãã¾ããã
ã¿ã¼ã²ããã°ã«ã¼ãããã¾ã使ã£ããã¨ããªãã®ã§æ¨æ¸¬ã«ãªãã¾ãããderegistrationãèµ°ãã¨ã¢ã¯ã»ã¹ãæ°è¦ã«æ¥ããã¨ã¯ãªããã®ã®ã
podã®åé¤ãå
è¡ãã¦èµ°ããLBå´ã§å¤ãåã«ã¢ã¯ã»ã¹ãæµããã¦ãã¾ãã¨504ãåºãã±ã¼ã¹ãããã®ã§ã¯ãªããã¨æãã¾ãã
HPAããã£ãã使ã£ã¦ããã¢ã¯ã»ã¹ãå¤ããµã¼ãã¹ã®ã±ã¼ã¹ã ã¨504ã¯ããããåºã¦ãã¾ãããããã¾ããã
ããã¯ãing->svc->deployã®replicasæ°ãå¤æ´ãã¦ãããã¿ã¼ã²ããã°ã«ã¼ãå¤æ´ãã¨ããæ¤ç¥ãã¿ã¼ã³ã¨ç¸æ§ãæªããã ã¨æãã¾ãã
æ¤ç¥ãã¿ã¼ã³ã®å¨æã®åéã«å
¥ã£ã¦podãåé¤ãããæ¹ãå
ã«ãªãã±ã¼ã¹ã¯å¤ã
ããã¨æãã®ã§ã504ã¯é¿ãã«ããã§ãã
deploymentå®ç¾©ã® preStop
ã§alb-ingress-controllerå´ãååæ¤ç¥ã§ããæéã®sleepãæãã§podãæ¢ããããã«ããããªã©ãã¯ã¼ã¯ã¢ã©ã¦ã³ãã«ãªãããããã¾ããã
ååã«æ¤è¨¼ã§ãã¦ããªããã¤ã³ããªã®ã§ãã£ã¨è¯ãæ¹æ³ãããã°ã³ã¡ã³ãçãããããã¨å¬ããã§ãã
hostã®å²å½æé
大ä½30ç§å¼±ã§ã¹ãã¼ã¿ã¹ãPendingããContainerCreatingã«ãªãã¾ãã
ããããã¤ã¡ã¼ã¸ã®pullãå§ã¾ããRunningã«ãªãã¾ã§å¤§ä½1åå¼±ã¨ãã£ãæãã§ããã
ä»åã¯nginxã¤ã¡ã¼ã¸ã§é常ã«å°ãããµã¤ãºãªã®ã§pullæéããã¾ãå½±é¿ãã¾ããã§ãããã1GB+ã®ã¤ã¡ã¼ã¸pullã¯å°ãæéããããããããã¾ããã
ã¨ã¯ãã£ã¦ããEKSã¨ããããFargateã®ç¹æ§ã«ç±æ¥ãããã®ãªã®ã§ECSã使ããã¦ããå ´åã¯æ¢ç¥ããããã¾ãããâ¦ã
iam-for-pods
å
ã«key/secretã使ã£ãæ¹æ³ãç´¹ä»ãã¾ããããiam-for-podsã使ã£ãæ¹æ³ãç´¹ä»ãã¾ãã
ãããkey/secretã使ãæ¹å¼ã§è©¦ãã¦ãããä¸æ¦alb-ingress-controllerã®ãªã½ã¼ã¹ã念ã®çºåé¤ãã¦ãã ããã
kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/rbac-role.yaml kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/alb-ingress-controller.yaml
ã¯ã©ã¹ã¿ã«å¯¾ãã¦oidc providerãç´ä»ãã¦ããALBã®IAM権éãä»ä¸ãã¾ãã
policyArnã¯ä¸ã§ä½æããALBIngressControllerIAMPolicyãåå¨ãã¦ããã°ãããæµç¨ãã¦ãã ããã
eksctl utils associate-iam-oidc-provider --region=ap-northeast-1 --cluster=poc --approve curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/iam-policy.json policyArn=$(aws iam create-policy \ --policy-name ALBIngressControllerIAMPolicy \ --policy-document file://iam-policy.json | jq -r .Policy.Arn) eksctl create iamserviceaccount --name alb-ingress-controller \ --namespace kube-system \ --cluster poc \ --attach-policy-arn ${policyArn} \ --approve --override-existing-serviceaccounts
ä½æããã¨ã以ä¸ã®ãããªæ å ±ãåãã¾ãã
$ > kubectl get sa -n kube-system alb-ingress-controller -o jsonpath="{.metadata.annotations['eks\.amazonaws\.com/role-arn']}" arn:aws:iam::xxx:role/eksctl-poc-addon-iamserviceaccount-ku-Role1-CBGA2Q1975Q9
次ã«alb-ingress-controller.yamlããããã¤ãã¾ãã
å
ã»ã©ã¨éã£ã¦envã§key/secretã®æå®ãè¡ãã¾ããã
apiVersion: apps/v1 kind: Deployment metadata: labels: app.kubernetes.io/name: alb-ingress-controller name: alb-ingress-controller namespace: kube-system spec: selector: matchLabels: app.kubernetes.io/name: alb-ingress-controller template: metadata: labels: app.kubernetes.io/name: alb-ingress-controller spec: serviceAccountName: alb-ingress-controller containers: - name: alb-ingress-controller image: docker.io/amazon/aws-alb-ingress-controller:v1.1.4 args: - --ingress-class=alb - --cluster-name=poc - --aws-region=ap-northeast-1 - --aws-vpc-id=vpc-xxxx # eksctlã§ä½æãããVPCã®id resources: {}
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/rbac-role.yaml kubectl apply -f alb-ingress-controller.yaml
alb-ingress-controllerã®podãä½æããããä¸è¨ã§è¨è¼ããnginxãåããããã®ãªã½ã¼ã¹ãapplyãã¦ãã ããã
envã§key/secretãæå®ããªãå ´åã¨åæ§ã«LBãä½ãããã¢ã¯ã»ã¹ã§ããããã«ãªã£ã¦ãã¾ãã
æåã¯oidc id providerã®æ¦å¿µãããããããã ã£ãã®ã§æ¬é ãã¦ããã®ã§ããããã®ããããå²ã¨æ¥½ã«è¨å®ã§ããããã«ãªã£ã¦ãã¾ããã
eksctlã§iamserviceaccountãä½ãã¨è£å´ã§CloudFormationãåãã¦ããã®ã§ãããä¸ã§ã¯oidc id providerã¸ã®ç´ä»ãããã£ã¦ããã¦ããããã§ãã
{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "IAM role for serviceaccount \"kube-system/alb-ingress-controller\" [created and managed by eksctl]", "Resources": { "Role1": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Statement": [ { "Action": [ "sts:AssumeRoleWithWebIdentity" ], "Condition": { "StringEquals": { "oidc.eks.ap-northeast-1.amazonaws.com/id/yyy:aud": "sts.amazonaws.com", "oidc.eks.ap-northeast-1.amazonaws.com/id/yyy:sub": "system:serviceaccount:kube-system:alb-ingress-controller" } }, "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::xxx:oidc-provider/oidc.eks.ap-northeast-1.amazonaws.com/id/yyy } } ], "Version": "2012-10-17" }, "ManagedPolicyArns": [ "arn:aws:iam::xxx:policy/ALBIngressControllerIAMPolicy" ] } } }, "Outputs": { "Role1": { "Value": { "Fn::GetAtt": "Role1.Arn" } } } }
eksctlçµç±ã§ä½æããSAã¯rbac-role.yamlãapplyãããã¨ã«ããannotationãæ¶ããã®ã§ã¯ãªãããã¨æã£ã¦ãã¾ãããæ®ã£ã¦ãã¾ããã
ããã£ããã¤ã³ã
- v.1.1.4ã®ã¿ã°ã§alb-ingress-controller.yamlããããã¤ãããv.1.1.3ã®ã¤ã¡ã¼ã¸ã使ãããããã«ãªã£ã¦ãã
- fargate profileã®IAMã«ALBä½æ権éãããã°ALBãä½ãããã¨æã£ããä½ããã¦ããªã
- iam-for-pods or envã«key/secretæå®ããå¿ è¦ãããã¨ç¥ã
- Authentication Issues On EKS Cluster with Fargate Policy · Issue #1092 · kubernetes-sigs/aws-alb-ingress-controller · GitHub
- eksctl delete clusterã§cfnãã³ã±ã¦åé¤ãããªã
- æ¨æ¸¬ã§ãããèªåã§applyãããªã½ã¼ã¹ãæ®ã£ã¦ããã¨fargate profileå´ã§podãåé¤->deployã§ä½ãããã®ç¹°ãè¿ããèµ·ããã®ã§ã¯ãªããã¨...
- æåã§é©å½ã«VPCã¨ããæ¶ãå§ãã¦fargate profileããªããªãåé¤ãããªãæåã«ãªã£ã¦ãããé ãæ±ãã¾ãã
- 20åãããå¾ ã£ããã¡ããã¨åé¤ããã¾ãã
- ãªã½ã¼ã¹ãå
¨é¨åé¤ãã¦eksctl delete clusterãå©ãã¦ãVPCã®åé¤ã§ã³ã±ã¦ããã®ã確èª
- ãªãã©ã¤ã§ãæåããªãã®ã§VPCã¯æåã§æ¶ãã¾ãã
- ããã£ã½ã=>eksctl resources not really deleted after deleting cluster · Issue #1651 · weaveworks/eksctl · GitHub
The vpc 'vpc-xxx' has dependencies and cannot be deleted. (Service: AmazonEC2; Status Code: 400; Error Code: DependencyViolation; Request ID: u-u-i-d-x)
ã¨åºã
ææ
EC2ã管çããããªãã¨ãã観ç¹ã§ã¯Fargateã§å®çµã§ããããã«ãªã£ã¦ããã®ã§è¯ãããã§ãã
LBã®ã¿ã¼ã²ããã°ã«ã¼ãããã®åé¤å¦çã¨podãæ¶ããã¿ã¤ãã³ã°ã§ã¨ã©ã¼ãåºãã®ã¯ç¾ç¶ã¯ã¼ã¯ã¢ã©ã¦ã³ããå¿
è¦ããã ã¨æãã¾ããã
å®éå
¨é¨Fargateã«ãããã¨è¨ãããã¨ã³ã¹ãã¯ãã¾ãè¯ããªãããã«æãã¾ããã
alb ingress controllerãå§ãã¨ããk8sã®ä¸ãæ´ãããããªpodã¯1host 1podããªã¼ãã¼ã¹ããã¯ãªã®ã§ããããã£ãpodã¯ã¾ã¨ãã¦1ã¤ã®nodeã§åããããããã«æãã¾ãã
ä»ã®è¨äºã§ãè¨åããã¦ãã¾ãããDaemonsetã§fluentdãåããã¦ãããã¿ãããªãã¨ãã§ããªãã®ã§ãã°åéãsidecarã§é
ç½®ããå¿
è¦ãããã¨ããã®ãå®éç¨ã§ã¯æéã«ãªãããããã¾ããã