Skip to content

Instantly share code, notes, and snippets.

@oflouis
Created October 2, 2022 06:48
Show Gist options
  • Save oflouis/421443c6d5b608f80d291171452a41d5 to your computer and use it in GitHub Desktop.
Save oflouis/421443c6d5b608f80d291171452a41d5 to your computer and use it in GitHub Desktop.
In AWS, installing Prometheus-stack and enabling HTTPS in Grafana

Subject

  • How to install a Prometheus-stack in AWS EKS
  • configure with
    • persistent volume (AWS EBS)
    • load balancer with HTTPS (AWS ELB)

Prerequisites

  • Running an AWS EKS
  • A certificate created at ACM
  • EBS CSI driver installation in the EKS
  • A customization file that has values to override in the prometheus-stack chart

Customization File (name : custom.yaml)

When you create a file, you should set your certificate in ${ACM_CERT_ARN} and would adjust suitably resources, storage size, etc.

alertmanager:
  service:
    type: NodePort
grafana:
  service:
    annotations:
      service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
      # service.beta.kubernetes.io/aws-load-balancer-internal: 'true' # unset this annotation if necessary
      service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
      service.beta.kubernetes.io/aws-load-balancer-ssl-cert: ${ACM_CERT_ARN}
      service.beta.kubernetes.io/aws-load-balancer-ssl-ports: '443'
    type: LoadBalancer
  extraExposePorts:
    - name: https
      port: 443
      targetPort: 3000
  resources:
    limits:
      cpu: 200m
      memory: 256Mi
    requests:
      cpu: 100m
      memory: 128Mi
  persistence:
    type: pvc
    enabled: true
    storageClassName: gp2
    accessModes:
      - ReadWriteOnce
    size: 10Gi
prometheus:
  service:
    type: NodePort
  prometheusSpec:
    retention: 10d
    retentionSize: "45GB"
    resources:
      limits:
        cpu: 500m
        memory: 512Mi
      requests:
        cpu: 200m
        memory: 256Mi
    storageSpec:
      volumeClaimTemplate:
        spec:
          storageClassName: gp2
          accessModes: ["ReadWriteOnce"]
          resources:
            requests:
              storage: 50Gi

Installation

# Add the prometheus chart repository.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

# Create a namespace where components will be in.
# In this guide, we will use the namespace named monitoring.
kubectl create ns monitoring

# Install with customized values like above.
helm install prometheus-stack prometheus-community/kube-prometheus-stack -f ./custom.yaml -n monitoring

# Inspect the installed release.
kubectl get pods -l "release=prometheus-stack" -n monitoring
helm get values prometheus-stack -n monitoring
kubectl get pvc -n monitoring
kubectl get pv -n monitoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment