<5> EKS Persistent Volumes for Instance Store & Add NodeGroup 1 클러스터는 기존 것을 유지한다. 신규 노드 그룹 ng2 생성한다 - Blog : 서버는 1대로 생성한다. c5d.large 의 EC2 인스턴스 스토어(임시 블록 스토리지) 설정 작업 https://aws.amazon.com/ko/blogs/containers/eks-persistent-volumes-for-instance-store/ https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/InstanceStorage.html 2 인스턴스 스토어는 EC2 스토리지(EBS) 정보에 출력되지는 않는다 3 # 인스턴스 스토어 볼륨이 있는 c5 모든 타입의 스토리지 크기 aws ec2 describe-instance-types --filters "Name=instance-type,Values=c5*" "Name=instance-storage-supported,Values=true" --query "InstanceTypes[].[InstanceType, InstanceStorageInfo.TotalSizeInGB]" --output table -------------------------- | DescribeInstanceTypes | +---------------+--------+ | c5d.large | 50 | | c5d.12xlarge | 1800 | ... # 신규 노드 그룹 생성 eksctl create nodegroup --help eksctl create nodegroup -c $CLUSTER_NAME -r $AWS_DEFAULT_REGION --subnet-ids "$PubSubnet1","$PubSubnet2","$PubSubnet3" --ssh-access \ -n ng2 -t c5d.large -N 1 -m 1 -M 1 --node-volume-size=30 --node-labels disk=nvme --max-pods-per-node 100 --dry-run > myng2.yaml (20분 걸림) 4 cat < nvme.yaml preBootstrapCommands: - | # Install Tools yum install nvme-cli links tree jq tcpdump sysstat -y # Filesystem & Mount mkfs -t xfs /dev/nvme1n1 mkdir /data mount /dev/nvme1n1 /data # Get disk UUID uuid=\$(blkid -o value -s UUID mount /dev/nvme1n1 /data) # Mount the disk during a reboot echo /dev/nvme1n1 /data xfs defaults,noatime 0 2 >> /etc/fstab EOT sed -i -n -e '/volumeType/r nvme.yaml' -e '1,$p' myng2.yaml eksctl create nodegroup -f myng2.yaml 인스턴스 스토어 볼륨을 가지고 있다. 임시 스토리지 - 속도가 빠르다. 5 # 노드 보안그룹 ID 확인 NG2SGID=$(aws ec2 describe-security-groups --filters Name=group-name,Values=*ng2* --query "SecurityGroups[*].[GroupId]" --output text) aws ec2 authorize-security-group-ingress --group-id $NG2SGID --protocol '-1' --cidr 192.168.1.100/32 6 # 워커 노드 SSH 접속 N4=192.168.3.160 ssh ec2-user@$N4 hostname # 확인 ssh ec2-user@$N4 sudo nvme list // 인스턴스 스토어 확인 = 휘발성이다. ssh ec2-user@$N4 sudo lsblk -e 7 -d // 용량 확인 ssh ec2-user@$N4 sudo df -hT -t xfs // 파일 시스템 확인 ssh ec2-user@$N4 sudo tree /data ssh ec2-user@$N4 sudo cat /etc/fstab 7 # (옵션) max-pod 확인 kubectl describe node -l disk=nvme | grep Allocatable: -A7 Allocatable: attachable-volumes-aws-ebs: 25 cpu: 1930m ephemeral-storage: 27905944324 hugepages-1Gi: 0 hugepages-2Mi: 0 memory: 3097552Ki pods: 100 8 # (옵션) kubelet 데몬 파라미터 확인 ? 버그 ? --max-pods=29 --max-pods=100 ssh ec2-user@$N4 sudo ps -ef | grep kubelet root 2972 1 0 16:03 ? 00:00:09 /usr/bin/kubelet --config /etc/kubernetes/kubelet/kubelet-config.json --kubeconfig /var/lib/kubelet/kubeconfig -- 9 스토리지 클래스 재생성 # 기존 삭제 #curl -s -O https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml kubectl delete -f local-path-storage.yaml # sed -i 's/opt/data/g' local-path-storage.yaml kubectl apply -f local-path-storage.yaml # 모니터링 watch 'kubectl get pod -owide;echo;kubectl get pv,pvc' ssh ec2-user@$N4 iostat -xmdz 1 -p nvme1n1 # 측정 : Read #curl -s -O https://raw.githubusercontent.com/wikibook/kubepractice/main/ch10/fio-read.fio kubestr fio -f fio-read.fio -s local-path --size 10G --nodeselector disk=nvme // nodeselector 사용.