Sign in
agent:

Install Prometheus and Grafana on the minikube cluster on EC2 instance in the monitoring namespace

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
  1. 1

    Install helm on minikube cluster on EC2 Instance

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
    # To install helm curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 chmod 700 get_helm.sh ./get_helm.sh
    copied
    1
  2. 2

    Create a namespace called monitoring on the minikube cluster on the EC2 instance

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
    # Create a namespace monitoring kubectl create namespace monitoring
    copied
    2
  3. 3

    Install Prometheus on minikube cluster

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
    3
    1. 3.1

      Add a helm repo for prometheus on the minikube cluster

      There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
      # To add helm chart for prometheus helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
      copied
      3.1
    2. 3.2

      Install Prometheus on minikube cluster in the monitoring namespace

      There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
      # Installing prometheus in monitoring namespace helm install prometheus prometheus-community/prometheus --namespace monitoring
      copied
      3.2
    3. 3.3

      To expose prometheus service (so it can be accessed outside the cluster)

      There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
      # To expose prometheus service (would change type from cluster IP to node port and create a new service) kubectl expose service prometheus-server --namespace=monitoring --type=NodePort --target-port=9090 --name=prometheus-server-ext
      copied
      3.3
  4. 4

    Install Grafana on minikube cluster

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
    4
    1. 4.1

      Add a helm repo for grafana on the minikube cluster

      There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
      # Add helm repo for grafana helm repo add grafana https://grafana.github.io/helm-charts
      copied
      4.1
    2. 4.2

      Install Grafana on minikube cluster in the monitoring namespace with persistence enabled

      There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

      (Need to test out the persistence enabled flags with execution)

      # To install the helm repo in the monitoring namespace with persistence enabled helm install grafana grafana/grafana --namespace monitoring --set persistence.enabled=true,persistence.size=5Gi,persistence.storageClassName=standard
      copied
      4.2
    3. 4.3

      Fetch the user name (admin) and password for grafana from the install information

      There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

      Usually the secret is accessed using

      # Get your 'admin' user password by running:

      kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

      # Get your 'admin' user password by running: kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
      copied
      4.3
    4. 4.4

      To expose grafana service so it can be accessed outside the cluster)

      There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
      # To Expose Grafana service kubectl expose service grafana --type=NodePort --target-port=3000 --name=grafana-ext -n monitoring
      copied
      4.4
  5. 5

    Set prometheus as a data source for your grafana service in the minikube cluster

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    # Add prometheus as a data source for your grafana

    http://<minikube_ip>:<prom_service_node_port>

    # For example

    http://192.168.49.2:31000

    # Get node ports by running

    kubectl get svc -A


    Go to Grafana > Home > Connections > Add New Connections

    # Add prometheus as a data source for your grafana http://<minikube_ip>:<prom_service_node_port>
    copied
    5
  6. 6

    Expose prometheus-kube-state-metrics service in monitoring namespace to access the kube-state-metrics outside the cluster

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
    # Expose prometheus-kube-state-metrics service in monitoring namespace kubectl expose service prometheus-kube-state-metrics --type=NodePort --target-port=8080 --name=prometheus-kube-state-metrics-ext -n monitoring
    copied
    6
  7. 7

    Edit Prometheus server config map to scrape the kube-state-metrics being exposed

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    kubectl get cm

    kubectl edit cm <config_map_name> -n monitoring

    # For Example

    kubectl edit cm prometheus-server -n monitoring


    # Add a scraping job in prometheus-server cm under scrape configs

    - job_name: state_metrics

    static_configs:

    - targets:

    - prometheus-kube-state-metrics.monitoring.svc.cluster.local:8080



    After doing a rollout restart of the prometheus-server we can access the kube-state-metrics from the grafana/prometheus

    # Can be skipped if doing step 9 kubectl get cm kubectl edit cm <config_map_name> -n monitoring # For Example kubectl edit cm prometheus-server -n monitoring # Add a scraping job in prometheus-server cm under scrape configs - job_name: state_metrics static_configs: - targets: - prometheus-kube-state-metrics.monitoring.svc.cluster.local:8080
    copied
    7
    1. 7.1

      Do a rollout restart of the prometheus-server for the edited config map to take effect on the minikube cluster

      There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

      After this we can access the kube-state-metrics from the grafana/prometheus

      # after editing the config map do a rollout restart if needed kubectl rollout restart deployment prometheus-server -n monitoring
      copied
      7.1