-
Notifications
You must be signed in to change notification settings - Fork 1
/
14_container_insights.sh
executable file
·25 lines (15 loc) · 1.09 KB
/
14_container_insights.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/bash
set -eo pipefail
source ./common.sh
cd modules/container-insights
pwd=$(pwd)
export nodegroupa="$name-ng-a"
export nodegroupb="$name-ng-b"
STACK_NAME_A=$(eksctl get nodegroup --cluster "$name" --name "$nodegroupa" -o json | jq -r '.[].StackName')
ROLE_NAME_A=$(aws cloudformation describe-stacks --stack-name $STACK_NAME_A | jq -r '.Stacks[].Outputs[] | select(.OutputKey=="InstanceRoleARN") | .OutputValue' | cut -f2 -d/)
aws iam attach-role-policy --role-name $ROLE_NAME_A --policy-arn arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy || true
STACK_NAME_B=$(eksctl get nodegroup --cluster "$name" --name "$nodegroupb" -o json | jq -r '.[].StackName')
ROLE_NAME_B=$(aws cloudformation describe-stacks --stack-name $STACK_NAME_B | jq -r '.Stacks[].Outputs[] | select(.OutputKey=="InstanceRoleARN") | .OutputValue' | cut -f2 -d/)
aws iam attach-role-policy --role-name $ROLE_NAME_B --policy-arn arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy || true
j2 cwagent-fluentd-quickstart.yaml.j2 > cwagent-fluentd-quickstart.yaml --undefined
kubectl apply -f cwagent-fluentd-quickstart.yaml