brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Nov 19. 2023

38탄-16. EKS DB -Stackable

<1> Stackable Data Platform = 오픈소스 데이터 관련 애플리케이션 손쉽게 배포 관리

<2> Amazon EKS 윈클릭 배포 가이드 : v1.26 - CloudFormation_Link

<3> 기본 설치

<4> Stackable 설치(1.0.0-rc3)





<1> Stackable Data Platform = 오픈소스 데이터 관련 애플리케이션 손쉽게 배포 관리


Stackable Data Platform (SDP) : 오픈소스 데이터 관련 애플리케이션 손쉽게 배포 관리 



1

관리 가능한 버전들 


https://docs.stackable.tech/home/stable/operators/supported_versions



2

라이센스별 지원 범위



https://stackable.tech/en/plans/



3

사전 준비

EC2 키페어

Access-key / Secret Key




<2> Amazon EKS 윈클릭 배포 가이드 : v1.26 - CloudFormation_Link




1

Cloudformation 변경 내용 

베스천 작업용 EC2를 우분트로 변경함 = ubuntu 로 로그인 , 아마존 리눅스 사용시 소스로 설치해야 하는 어려운 부분 있음.

워커 노드 : 인스턴스 타입 c5.2xlarge 이상이 되어야 함 , 툴 설치 batcat.

쿠버네티스 v1.26으로  설치함.



2



# YAML 파일 다운로드

curl -O https://s3.ap-northeast-2.amazonaws.com/cloudformation.cloudneta.net/EKS/eks-oneclick-2.yaml




# CloudFormation 스택 배포

# aws cloudformation deploy --template-file eks-oneclick.yaml --stack-name myeks --parameter-overrides KeyName=<My SSH Keyname> SgIngressSshCidr=<My Home Public IP Address>/32 MyIamUserAccessKeyID=<IAM User의 액세스키> MyIamUserSecretAccessKey=<IAM User의 시크릿 키> ClusterBaseName='<eks 이름>' --region ap-northeast-2



예시) aws cloudformation deploy --template-file eks-oneclick-2.yaml --stack-name myeks --parameter-overrides KeyName=kp-gasida SgIngressSshCidr=$(curl -s ipinfo.io/ip)/32  MyIamUserAccessKeyID=AKIA5... MyIamUserSecretAccessKey='CVNa2...' ClusterBaseName=myeks --region ap-northeast-2



# CloudFormation 스택 배포 완료 후 작업용 EC2 IP 출력

aws cloudformation describe-stacks --stack-name myeks --query 'Stacks[*].Outputs[0].OutputValue' --output text



3

# 작업용 EC2 SSH 접속

ssh -i ~/.ssh/kp-gasida.pem ubuntu@$(aws cloudformation describe-stacks --stack-name myeks --query 'Stacks[*].Outputs[0].OutputValue' --output text)

-----------------




# batcat

#  alias cat='batcat --paging=never'   내용이  /etc/profile에 추가 되어 있음.

하일라이트 


cat precmd.yaml

cat precmd.yaml -p

cat precmd.yaml -n

cat /var/log/syslog

batcat -h

batcat -L



4

# 정보 확인 : v1.26, c5.2xlarge

kubectl get node --label-columns=node.kubernetes.io/instance-type

NAME                                               STATUS   ROLES    AGE   VERSION                INSTANCE-TYPE

ip-192-168-1-37.ap-northeast-2.compute.internal    Ready    <none>   42m   v1.26.10-eks-e71965b   c5.2xlarge

ip-192-168-2-253.ap-northeast-2.compute.internal   Ready    <none>   42m   v1.26.10-eks-e71965b   c5.2xlarge

ip-192-168-3-207.ap-northeast-2.compute.internal   Ready    <none>   42m   v1.26.10-eks-e71965b   c5.2xlarge




<3> 기본 설치


# 노드 PrivateIP 변수 지정

N1=$(kubectl get node --label-columns=topology.kubernetes.io/zone --selector=topology.kubernetes.io/zone=ap-northeast-2a -o jsonpath={.items[0].status.addresses[0].address})


N2=$(kubectl get node --label-columns=topology.kubernetes.io/zone --selector=topology.kubernetes.io/zone=ap-northeast-2b -o jsonpath={.items[0].status.addresses[0].address})


N3=$(kubectl get node --label-columns=topology.kubernetes.io/zone --selector=topology.kubernetes.io/zone=ap-northeast-2c -o jsonpath={.items[0].status.addresses[0].address})


echo "export N1=$N1" >> /etc/profile

echo "export N2=$N2" >> /etc/profile

echo "export N3=$N3" >> /etc/profile

echo $N1, $N2, $N3



1

# 노드 보안그룹에 eksctl-host 에서 노드(파드)에 접속 가능하게 룰(Rule) 추가 설정

워커 노드 보안그룹에 추가 ~


NGSGID=$(aws ec2 describe-security-groups --filters Name=group-name,Values='*ng1*' --query "SecurityGroups[*].[GroupId]" --output text)


aws ec2 authorize-security-group-ingress --group-id $NGSGID --protocol '-1' --cidr 192.168.1.100/32



2

# AWS LoadBalancer Controller

helm repo add eks https://aws.github.io/eks-charts


helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=$CLUSTER_NAME  --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller



3

# ExternalDNS 컨트롤러 설치 


MyDomain=<자신의 도메인>

echo "export MyDomain=<자신의 도메인>" >> /etc/profile


MyDomain=masterseo1.link


echo "export MyDomain=masterseo1.link" >> /etc/profile


MyDnsHostedZoneId=$(aws route53 list-hosted-zones-by-name --dns-name "${MyDomain}." --query "HostedZones[0].Id" --output text)


echo $MyDomain, $MyDnsHostedZoneId



curl -s -O https://raw.githubusercontent.com/cloudneta/cnaeblab/master/_data/externaldns.yaml


MyDomain=$MyDomain MyDnsHostedZoneId=$MyDnsHostedZoneId envsubst < externaldns.yaml | kubectl apply -f -



4

# kube-ops-view


helm repo add geek-cookbook https://geek-cookbook.github.io/charts/


helm install kube-ops-view geek-cookbook/kube-ops-view --version 1.2.2 --set env.TZ="Asia/Seoul" --namespace kube-system


kubectl patch svc -n kube-system kube-ops-view -p '{"spec":{"type":"LoadBalancer"}}'


kubectl annotate service kube-ops-view -n kube-system "external-dns.alpha.kubernetes.io/hostname=kubeopsview.$MyDomain"


echo -e "Kube Ops View URL = http://kubeopsview.$MyDomain:8080/#scale=4.0"



5

# ebs gp3 스토리지 클래스 생성 : 파일시스템 xfs


kubectl patch sc gp2 -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'


kubectl apply -f https://raw.githubusercontent.com/gasida/DOIK/main/1/gp3-sc-xfs.yaml



6

# efs 스토리지 클래스 생성 : 실습 편리를 위해서 삭제 정책은 Delete(기본값)을 사용


cat <<EOT > efs-sc.yaml

kind: StorageClass

apiVersion: storage.k8s.io/v1

metadata: 

  name: efs-sc

provisioner: efs.csi.aws.com

parameters: 

  provisioningMode: efs-ap

  fileSystemId: $EFS_ID

  directoryPerms: "700"

EOT



kubectl apply -f efs-sc.yaml



7

# 프로메테우스-스택 생성

kubectl create ns monitoring


helm repo add prometheus-community https://prometheus-community.github.io/helm-charts


CERT_ARN=`aws acm list-certificates --query 'CertificateSummaryList[].CertificateArn[]' --output text`



## 파라미터 파일 생성


cat <<EOT > monitor-values.yaml

prometheus:

  prometheusSpec:

    podMonitorSelectorNilUsesHelmValues: false

    serviceMonitorSelectorNilUsesHelmValues: false

    #probeSelectorNilUsesHelmValues: false

    retention: 5d

    retentionSize: "10GiB"

    scrapeInterval: '15s'

    evaluationInterval: '15s'

  ingress:

    enabled: true

    ingressClassName: alb

    hosts: 

      - prometheus.$MyDomain

    paths: 

      - /*

    annotations:

      alb.ingress.kubernetes.io/scheme: internet-facing

      alb.ingress.kubernetes.io/target-type: ip

      alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]'

      alb.ingress.kubernetes.io/certificate-arn: $CERT_ARN

      alb.ingress.kubernetes.io/success-codes: 200-399

      alb.ingress.kubernetes.io/load-balancer-name: myeks-ingress-alb

      alb.ingress.kubernetes.io/group.name: study

      alb.ingress.kubernetes.io/ssl-redirect: '443'

grafana:

  defaultDashboardsTimezone: Asia/Seoul

  adminPassword: prom-operator

  defaultDashboardsEnabled: false

  ingress:

    enabled: true

    ingressClassName: alb

    hosts: 

      - grafana.$MyDomain

    paths: 

      - /*

    annotations:

      alb.ingress.kubernetes.io/scheme: internet-facing

      alb.ingress.kubernetes.io/target-type: ip

      alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]'

      alb.ingress.kubernetes.io/certificate-arn: $CERT_ARN

      alb.ingress.kubernetes.io/success-codes: 200-399

      alb.ingress.kubernetes.io/load-balancer-name: myeks-ingress-alb

      alb.ingress.kubernetes.io/group.name: study

      alb.ingress.kubernetes.io/ssl-redirect: '443'

defaultRules:

  create: false

kubeEtcd:

  enabled: false

alertmanager:

  enabled: false

EOT



## 배포

helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack --version 51.7.0 -f monitor-values.yaml --namespace monitoring



8

## 그라파나 ingress 도메인으로 웹 접속 : 기본 계정 - admin / prom-operator

echo -e "Grafana Web URL = https://grafana.$MyDomain"



9

# Metrics-server 배포

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml



10

집 PC에서 직접 Stackable ENDPOINTS(워커 노드의 NodePort)로 접속을 위한 설정 → 아래 보안 그룹 추가 후 접속 가능



# 워커노드의 '#-nodegroup-ng1-remoteAccess' 보안 그룹에 자신의 집 공인IP 접속 허용 추가


NGSGID=$(aws ec2 describe-security-groups --filters Name=group-name,Values='*ng1*' --query "SecurityGroups[*].[GroupId]" --output text)


aws ec2 authorize-security-group-ingress --group-id $NGSGID --protocol '-1' --cidr $(curl -s ipinfo.io/ip)/32


aws ec2 authorize-security-group-ingress --group-id $NGSGID --protocol '-1' --cidr $(curl -s ipinfo.io/ip)/32




<4> Stackable 설치(1.0.0-rc3)



Operators layer 지원

Stack Layer 지원  - Superset은 시각화 툴.

Demo Layer 지원 - 한번에 spark등 모두 설치가 된다.




1

https://docs.stackable.tech/management/stable/stackablectl/



https://docs.stackable.tech/management/stable/stackablectl/installation



https://github.com/stackabletech/stackable-cockpit



https://docs.stackable.tech/management/stable/stackablectl/customization/




2

# 다운로드

#curl -L -o stackablectl https://github.com/stackabletech/stackable-cockpit/releases/download/stackablectl-1.0.0-rc2/stackablectl-x86_64-unknown-linux-gnu


curl -L -o stackablectl https://github.com/stackabletech/stackable-cockpit/releases/download/stackablectl-1.0.0-rc3/stackablectl-x86_64-unknown-linux-gnu


chmod +x stackablectl


mv stackablectl /usr/local/bin



# 확인

stackablectl -h

stackablectl -V

stackablectl 1.0.0-rc3

stackablectl release list

...



# 자동완성

wget https://raw.githubusercontent.com/stackabletech/stackable-cockpit/main/extra/completions/stackablectl.bash


mv stackablectl.bash /etc/bash_completion.d/




# 제공 오퍼레이터

stackablectl operator list




# 제공 스택 = 오퍼레이터의 집합 


stackablectl stack list





# 제공 데모 : Stackable release 설치 > 스택 구성 > 데이터 구성

데모 = 한번에 관련 프로그램이 모두 설치가 된다.


stackablectl demo list




3

(선택)

프리뷰 버전~

웹으로 설치하는 방법

Stackable Cockpit : 웹 기반 SDP을 통해 스택을 배포 및 관리, 현재 preview - Link




다음

https://brunch.co.kr/@topasvga/3538




감사합니다.


매거진의 이전글 38탄-15. EKS DB -KEDA 설정 3/3

작품 선택

키워드 선택 0 / 3 0

댓글여부

afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari