github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/deploy/dev/k8s/utils/enable_metrics.sh (about)

     1  #!/bin/bash
     2  METRICS_ENABLED=$(kubectl get deploy,svc -n kube-system | grep -q metrics-server; echo $?)
     3  if [[ $METRICS_ENABLED == 0 ]]
     4  then 
     5    # See https://github.com/prometheus-operator/kube-prometheus/
     6    minikube addons disable metrics-server
     7    tmpdir=$(mktemp -d)
     8    pushd $tmpdir
     9    git clone https://github.com/prometheus-operator/kube-prometheus.git
    10  
    11    pushd kube-prometheus
    12    # NOTE: Taken from https://github.com/prometheus-operator/kube-prometheus#quickstart.
    13    # Create the namespace and CRDs, and then wait for them to be available before creating the remaining resources.
    14    kubectl apply --server-side -f manifests/setup
    15    kubectl wait \
    16    	--for condition=Established \
    17    	--all CustomResourceDefinition \
    18    	--namespace=monitoring
    19    kubectl apply -f manifests/
    20    popd
    21    rm -rf $tmpdir
    22  fi