kube-awsとは
10分でわかる「kube-aws」を参照ください。
kube-awsをメンテされている方にて記載されています。
既存のvpcに入れる時にハマった
kube-awsを使い始めて、既存のvpcになかなか入れられなかったのでメモ
試行錯誤した結果なので正しく無いかもしれないですが、このyamlで動きました。
cluster.yaml
clusterName: oreno-k8s
sshAccessAllowedSourceCIDRs:
- 0.0.0.0/0
apiEndpoints:
-
name: default
dnsName: oreno.k8s.dev.examlpe.com
loadBalancer:
subnets:
- name: ExistingPublicSubnet1
- name: ExistingPublicSubnet2
hostedZone:
id: ABCDEFGAAAAAA
keyName: oreno-keyname
region: us-west-2
kmsKeyArn: "arn:aws:kms:us-west-2:1234567890123:key/aaaaaaa-aaaaa-aaaaa-aaa-aaaaaaa"
controller:
instanceType: t2.medium
rootVolume:
size: 30
type: gp2
autoScalingGroup:
minSize: 2
maxSize: 3
rollingUpdateMinInstancesInService: 2
subnets:
- name: ExistingPublicSubnet1
- name: ExistingPublicSubnet2
worker:
nodePools:
- name: nodepool1
count: 2
instanceType: t2.medium
rootVolume:
size: 30
type: gp2
etcd:
count: 3
instanceType: t2.medium
rootVolume:
size: 30
type: gp2
subnets:
- name: ExistingPublicSubnet1
- name: ExistingPublicSubnet2
vpc:
id: vpc-123456789
subnets:
- name: ExistingPublicSubnet1
availabilityZone: us-west-2a
id: "subnet-1234567a"
- name: ExistingPublicSubnet2
availabilityZone: us-west-2c
id: "subnet-9876543e"
containerRuntime: docker
kubernetesDashboard:
adminPrivileges: true
insecureLogin: false
addons:
省略
experimental:
省略
ポイント
vpc
vpcはvpc.id、vpc.routeTableId、vpc.vpcCIDRは既存VPCの値を入れる
vpc:
id: vpc-123456789
subnets
subnetsのnameは任意、subnet.availabilityZone、subnet.idは既存のsubnetの値を入れる
subnets:
- name: ExistingPublicSubnet1
availabilityZone: us-west-2a
id: "subnet-1234567a"
- name: ExistingPublicSubnet2
availabilityZone: us-west-2c
id: "subnet-9876543e"
controller
controllerのsubnetsでsubnets.nameの値を指定する
複数指定することで複数AZで展開できる
controller:
instanceType: t2.medium
rootVolume:
size: 30
type: gp2
autoScalingGroup:
minSize: 2
maxSize: 3
rollingUpdateMinInstancesInService: 2
subnets:
- name: ExistingPublicSubnet1
- name: ExistingPublicSubnet2
etcd
controllerと同じくsubnetsでsubnets.nameの値を指定する
複数指定することで複数AZで展開できる
etcd:
count: 3
instanceType: t2.medium
rootVolume:
size: 30
type: gp2
subnets:
- name: ExistingPublicSubnet1
- name: ExistingPublicSubnet2
worker
ここでハマったのですが、workerにもworker.nodePools.subnetsがありますが、subnetsを指定するとエラーが出てデプロイ出来なかったです。
subnetsを指定しないとデプロイが出来て、複数台を複数AZにデプロイしてくれました。
指定しなかったらデフォルトでvpc.subnetを見るのかな??教えてエラい人・・
worker:
nodePools:
- name: nodepool1
count: 2
instanceType: t2.medium
rootVolume:
size: 30
type: gp2
PS.
kopsよりAWS寄りに実装されているので、AWSでk8sを扱う方はkube-awsはオススメです。