aws eks --region ap-northeast-2 update-kubeconfig --name ipv6-eks-cluster --alias ipv6-eks-cluster
Shell
복사
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
type: NodePort
selector:
app: nginx
ports:
- port: 80
targetPort: 80
protocol: TCP
YAML
복사
kubectl apply -f deployment.yaml
Shell
복사
kubectl get po -o wide
Shell
복사
helm repo add eks https://aws.github.io/eks-charts
helm repo update eks
helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
-n kube-system \
--set clusterName=ipv6-eks-cluster \
--set serviceAccount.create=false \
--set serviceAccount.name=aws-load-balancer-controller
Shell
복사
public_a=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=ipv6-public-subnet-a" --query "Subnets[].SubnetId[]" --region ap-northeast-2 --output text)
public_b=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=ipv6-public-subnet-b" --query "Subnets[].SubnetId[]" --region ap-northeast-2 --output text)
private_a=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=ipv6-private-subnet-a" --query "Subnets[].SubnetId[]" --region ap-northeast-2 --output text)
private_b=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=ipv6-private-subnet-b" --query "Subnets[].SubnetId[]" --region ap-northeast-2 --output text)
public_subnet_name=("$public_a" "$public_b")
private_subnet_name=("$private_a" "$private_b")
for name in "${public_subnet_name[@]}"
do
aws ec2 create-tags --resources $name --tags Key=kubernetes.io/role/elb,Value=1
done
for name in "${private_subnet_name[@]}"
do
aws ec2 create-tags --resources $name --tags Key=kubernetes.io/role/internal-elb,Value=1
done
Shell
복사
target type을 instance로 설정하고 싶다면 node instance에서 Assign primary IPv6 IP를 활성화해야 합니다.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ipv6-alb
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: 'instance'
alb.ingress.kubernetes.io/load-balancer-name: ipv6-alb
alb.ingress.kubernetes.io/healthcheck-path: /
alb.ingress.kubernetes.io/ip-address-type: dualstack-without-public-ipv4
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx
port:
number: 80
YAML
복사
kubectl apply -f ingress.yaml
Shell
복사