Search

Prometheus

ENV

EKS_CLUSTER_NAME="<CLUSTER_NAME>" CLUSTER_OIDC=$(aws eks describe-cluster --name $EKS_CLUSTER_NAME --query "cluster.identity.oidc.issuer" --output text | cut -c 9-100) AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
Shell
복사

Metrics-server

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml kubectl get deployment metrics-server -n kube-system
Shell
복사

Prometheus Configure

Prometheus Helm Repo

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update helm repo list
Shell
복사

Namespace

kubectl create ns prometheus
Shell
복사

Prometheus install

helm install prometheus prometheus-community/prometheus \ --namespace prometheus \ --set alertmanager.persistentVolume.storageClass="gp2" \ --set server.persistentVolume.storageClass="gp2" \ -f values.yaml
Shell
복사
kubectl get all -n prometheus
Shell
복사

EBS CSI Driver Create

OIDC

eksctl utils associate-iam-oidc-provider --region ap-northeast-2 --cluster $EKS_CLUSTER_NAME --approve
Shell
복사

IRSA

eksctl create iamserviceaccount \ --name ebs-csi-controller-sa \ --region ap-northeast-2 \ --namespace kube-system \ --cluster $EKS_CLUSTER_NAME \ --role-name AmazonEKS_EBS_CSI_DriverRole \ --role-only \ --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \ --approve
Shell
복사

Create Addon

eksctl create addon --name aws-ebs-csi-driver --cluster $EKS_CLUSTER_NAME --service-account-role-arn arn:aws:iam::$AWS_ACCOUNT_ID:role/AmazonEKS_EBS_CSI_DriverRole eksctl get addon --name aws-ebs-csi-driver --cluster $EKS_CLUSTER_NAME
Shell
복사

Ingress (서브넷 Tag 지정해주기)

public subnet 키 : kubernetes.io/role/elb && 값 : 1
private subnet 키 : kubernetes.io/role/internal-elb && 값 : 1
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: ingress-monitoring namespace: prometheus annotations: alb.ingress.kubernetes.io/load-balancer-name: skills-alb alb.ingress.kubernetes.io/group.name: monitoring alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/target-type: ip alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]' spec: ingressClassName: alb rules: - http: paths: - path: /prometheus pathType: Prefix backend: service: name: prometheus-server port: number: 80
YAML
복사
kubectl apply -f ingress-prometheus.yaml
Shell
복사