Skip to content

Instantly share code, notes, and snippets.

@inductor
Created December 3, 2019 02:13
Show Gist options
  • Save inductor/2959e397a59be756ba8b6afab0db0a81 to your computer and use it in GitHub Desktop.
Save inductor/2959e397a59be756ba8b6afab0db0a81 to your computer and use it in GitHub Desktop.
簡単になったEKSのマネージドワーカーノード
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'EKS Managed Nodes'
Resources:
ManagedNodeGroup:
Type: AWS::EKS::Nodegroup
Properties:
ClusterName: cluster1
NodegroupName: worker1
ScalingConfig:
MinSize: 1
MaxSize: 5
DesiredSize: 1
Subnets:
Fn::Split:
- ","
- Fn::ImportValue: eksctl-cluster1-cluster::SubnetsPublic
InstanceTypes:
- t3.small
AmiType: AL2_x86_64
NodeRole:
Fn::GetAtt: NodeInstanceRole.Arn
Labels:
alpha.eksctl.io/cluster-name: cluster1
alpha.eksctl.io/nodegroup-name: worker1
Tags:
alpha.eksctl.io/nodegroup-name: worker1
alpha.eksctl.io/nodegroup-type: managed
NodeInstanceRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
Version: '2012-10-17'
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy
- arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy
- arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
Path: "/"
PolicyAutoScaling:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- autoscaling:DescribeAutoScalingGroups
- autoscaling:DescribeAutoScalingInstances
- autoscaling:DescribeLaunchConfigurations
- autoscaling:DescribeTags
- autoscaling:SetDesiredCapacity
- autoscaling:TerminateInstanceInAutoScalingGroup
- ec2:DescribeLaunchTemplateVersions
Effect: Allow
Resource: "*"
Version: '2012-10-17'
PolicyName:
Fn::Sub: "${AWS::StackName}-PolicyAutoScaling"
Roles:
- Ref: NodeInstanceRole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment