From 1dca2f29e54eccb6d8324c9b18e700ab5e980bcd Mon Sep 17 00:00:00 2001 From: Camil Blanaru Date: Mon, 13 Aug 2018 21:23:58 +0200 Subject: [PATCH 1/7] Allow deployments in custom namespace --- deploy | 19 ++++++++++++------- .../kube-state-metrics-rbac.yaml | 2 +- ...metheus-operator-cluster-role-binding.yaml | 2 +- manifests/prometheus/prometheus-k8s-rbac.yaml | 14 +++++++------- manifests/prometheus/prometheus-k8s.yaml | 2 +- ...metheus-k8s-service-monitor-apiserver.yaml | 2 +- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/deploy b/deploy index 5953385..68d3b5c 100755 --- a/deploy +++ b/deploy @@ -14,6 +14,7 @@ NODE_EXPORTER_DEFAULT_VERSION=v0.16.0 KUBE_STATE_METRICS_DEFAULT_VERSION=v1.3.1 NODE_LABEL_DEFAULT_KEY=beta.kubernetes.io/monit NODE_LABEL_DEFAULT_VALUE=prometheus +DEFAULT_NAMESPACE=monitoring ######################################################################################### #external Urls for Prometheus and Alertmanager @@ -36,10 +37,6 @@ if [ -z "${KUBECONFIG}" ]; then export KUBECONFIG=~/.kube/config fi -if [ -z "${NAMESPACE}" ]; then - NAMESPACE=monitoring -fi - #check for uncommitted changes echo -e "${ORANGE}Check for uncommitted changes" echo @@ -54,11 +51,19 @@ else tput sgr0 fi -echo -echo -e "${BLUE}Creating ${ORANGE}'monitoring' ${BLUE}namespace." +#Namespace +read -p "Enter desired namespace to deploy prometheus [$DEFAULT_NAMESPACE]: " NAMESPACE +NAMESPACE=${NAMESPACE:-$DEFAULT_NAMESPACE} tput sgr0 + +echo -e "${BLUE}Creating ${ORANGE}${NAMESPACE} ${BLUE}namespace." kubectl create namespace "$NAMESPACE" -echo + +#Set namespace in various resources +sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/kube-state-metrics/kube-state-metrics-rbac.yaml +sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s-rbac.yaml +sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s.yaml +sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml kctl() { kubectl --namespace "$NAMESPACE" "$@" diff --git a/manifests/kube-state-metrics/kube-state-metrics-rbac.yaml b/manifests/kube-state-metrics/kube-state-metrics-rbac.yaml index 8335172..0c28e0f 100644 --- a/manifests/kube-state-metrics/kube-state-metrics-rbac.yaml +++ b/manifests/kube-state-metrics/kube-state-metrics-rbac.yaml @@ -54,7 +54,7 @@ roleRef: subjects: - kind: ServiceAccount name: kube-state-metrics - namespace: monitoring + namespace: CUSTOM_NAMESPACE --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role diff --git a/manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml b/manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml index eb35485..bdbbde2 100644 --- a/manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml +++ b/manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml @@ -87,4 +87,4 @@ roleRef: subjects: - kind: ServiceAccount name: prometheus-operator - namespace: monitoring + namespace: CUSTOM_NAMESPACE diff --git a/manifests/prometheus/prometheus-k8s-rbac.yaml b/manifests/prometheus/prometheus-k8s-rbac.yaml index 74dc432..74af15b 100644 --- a/manifests/prometheus/prometheus-k8s-rbac.yaml +++ b/manifests/prometheus/prometheus-k8s-rbac.yaml @@ -2,13 +2,13 @@ apiVersion: v1 kind: ServiceAccount metadata: name: prometheus-k8s - namespace: monitoring + namespace: CUSTOM_NAMESPACE --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: Role metadata: name: prometheus-k8s - namespace: monitoring + namespace: CUSTOM_NAMESPACE rules: - apiGroups: [""] resources: @@ -67,7 +67,7 @@ apiVersion: rbac.authorization.k8s.io/v1beta1 kind: RoleBinding metadata: name: prometheus-k8s - namespace: monitoring + namespace: CUSTOM_NAMESPACE roleRef: apiGroup: rbac.authorization.k8s.io kind: Role @@ -75,7 +75,7 @@ roleRef: subjects: - kind: ServiceAccount name: prometheus-k8s - namespace: monitoring + namespace: CUSTOM_NAMESPACE --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: RoleBinding @@ -89,7 +89,7 @@ roleRef: subjects: - kind: ServiceAccount name: prometheus-k8s - namespace: monitoring + namespace: CUSTOM_NAMESPACE --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: RoleBinding @@ -103,7 +103,7 @@ roleRef: subjects: - kind: ServiceAccount name: prometheus-k8s - namespace: monitoring + namespace: CUSTOM_NAMESPACE --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding @@ -116,4 +116,4 @@ roleRef: subjects: - kind: ServiceAccount name: prometheus-k8s - namespace: monitoring + namespace: CUSTOM_NAMESPACE diff --git a/manifests/prometheus/prometheus-k8s.yaml b/manifests/prometheus/prometheus-k8s.yaml index 9ed519c..8bf6b89 100644 --- a/manifests/prometheus/prometheus-k8s.yaml +++ b/manifests/prometheus/prometheus-k8s.yaml @@ -45,6 +45,6 @@ spec: storage: PROMETHEUS_STORAGE_VOLUME_SIZE alerting: alertmanagers: - - namespace: monitoring + - namespace: CUSTOM_NAMESPACE name: alertmanager-main port: web diff --git a/manifests/prometheus/self-hosted/prometheus-k8s-service-monitor-apiserver.yaml b/manifests/prometheus/self-hosted/prometheus-k8s-service-monitor-apiserver.yaml index 40361f0..afd574b 100644 --- a/manifests/prometheus/self-hosted/prometheus-k8s-service-monitor-apiserver.yaml +++ b/manifests/prometheus/self-hosted/prometheus-k8s-service-monitor-apiserver.yaml @@ -12,7 +12,7 @@ spec: provider: kubernetes namespaceSelector: matchNames: - - default + - kube-system endpoints: - port: https interval: 30s From 090a126988e6caeec6b9168999ab03f3652f85b3 Mon Sep 17 00:00:00 2001 From: Camil Blanaru Date: Mon, 13 Aug 2018 21:32:48 +0200 Subject: [PATCH 2/7] Discover custom namespace --- teardown | 18 ++++++++++++++---- tools/alertmanager_proxy.sh | 7 +++++-- tools/grafana_proxy.sh | 4 ++-- tools/prometheus_proxy.sh | 4 ++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/teardown b/teardown index 10b54ff..40f9b84 100755 --- a/teardown +++ b/teardown @@ -12,14 +12,19 @@ if [ -z "${KUBECONFIG}" ]; then export KUBECONFIG=~/.kube/config fi -if [ -z "${NAMESPACE}" ]; then - NAMESPACE=monitoring -fi +#Namespace +NAMESPACE=$(kubectl get sts --all-namespaces | grep prometheus-k8s | cut -d " " -f1) kctl() { kubectl --namespace "$NAMESPACE" "$@" } +#Set namespace in various resources +sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/kube-state-metrics/kube-state-metrics-rbac.yaml +sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s-rbac.yaml +sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s.yaml +sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml + kctl delete -f manifests/node-exporter kctl delete -f manifests/kube-state-metrics find manifests/grafana -type f ! -name grafana.pvc.yaml -exec kubectl --namespace "$NAMESPACE" delete -f {} \; @@ -48,4 +53,9 @@ kubectl get crd -o 'jsonpath={.items[*].metadata.name}' | xargs -n 1 | fgrep cor #manually remove persistent volumes instructions echo -e "${GREEN}The persistent volumes for Grafana and Prometeus were not removed!" echo -e "${GREEN}To remove them, please run te following command:" -echo -e "${WHITE}kubectl get pvc -n ${NAMESPACE} | grep 'grafana\|prometheus' | cut -d " " -f 1 | xargs -n 1 kubectl delete pvc -n ${NAMESPACE}" \ No newline at end of file +echo -e "${WHITE}kubectl get pvc -n ${NAMESPACE} | grep 'grafana\|prometheus' | cut -d " " -f 1 | xargs -n 1 kubectl delete pvc -n ${NAMESPACE}" + +#clean sed generated files +find . -name "*.yaml-e" -exec rm -rf {} \; + +git checkout -- . \ No newline at end of file diff --git a/tools/alertmanager_proxy.sh b/tools/alertmanager_proxy.sh index aad1cdc..4c670b0 100755 --- a/tools/alertmanager_proxy.sh +++ b/tools/alertmanager_proxy.sh @@ -1,4 +1,7 @@ #!/bin/bash -POD=$(kubectl get pods --namespace=monitoring | grep alertmanager-main-0| cut -d ' ' -f 1) -kubectl port-forward $POD --namespace=monitoring 9093:9093 +#Namespace +NAMESPACE=$(kubectl get sts --all-namespaces | grep prometheus-k8s | cut -d " " -f1) + +POD=$(kubectl get pods --namespace=$NAMESPACE | grep alertmanager-main-0| cut -d ' ' -f 1) +kubectl port-forward $POD --namespace=$NAMESPACE 9093:9093 diff --git a/tools/grafana_proxy.sh b/tools/grafana_proxy.sh index 5081129..c5cfabb 100755 --- a/tools/grafana_proxy.sh +++ b/tools/grafana_proxy.sh @@ -1,4 +1,4 @@ #!/bin/bash -POD=$(kubectl get pods --namespace=monitoring | grep grafana| cut -d ' ' -f 1) -kubectl port-forward $POD --namespace=monitoring 3000:3000 +POD=$(kubectl get pods --namespace=$NAMESPACE | grep grafana| cut -d ' ' -f 1) +kubectl port-forward $POD --namespace=$NAMESPACE 3000:3000 diff --git a/tools/prometheus_proxy.sh b/tools/prometheus_proxy.sh index 068c15c..ab15a86 100755 --- a/tools/prometheus_proxy.sh +++ b/tools/prometheus_proxy.sh @@ -1,4 +1,4 @@ #!/bin/bash -POD=$(kubectl get pods --namespace=monitoring | grep prometheus-k8s-0| cut -d ' ' -f 1) -kubectl port-forward $POD --namespace=monitoring 9090:9090 +POD=$(kubectl get pods --namespace=$NAMESPACE | grep prometheus-k8s-0| cut -d ' ' -f 1) +kubectl port-forward $POD --namespace=$NAMESPACE 9090:9090 From 635a1c7b056eddf85e2323da379b331efcdf05e1 Mon Sep 17 00:00:00 2001 From: Camil Blanaru Date: Mon, 13 Aug 2018 22:10:03 +0200 Subject: [PATCH 3/7] Remove namespace from grafana dashboards configmap --- manifests/grafana/grafana-dashboards.cm.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/manifests/grafana/grafana-dashboards.cm.yaml b/manifests/grafana/grafana-dashboards.cm.yaml index 24549ed..5ac2bfd 100644 --- a/manifests/grafana/grafana-dashboards.cm.yaml +++ b/manifests/grafana/grafana-dashboards.cm.yaml @@ -915,7 +915,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-k8s-cluster-rsrc-use - namespace: monitoring - apiVersion: v1 data: k8s-node-rsrc-use.json: |- @@ -1858,7 +1857,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-k8s-node-rsrc-use - namespace: monitoring - apiVersion: v1 data: k8s-resources-cluster.json: |- @@ -3186,7 +3184,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-k8s-resources-cluster - namespace: monitoring - apiVersion: v1 data: k8s-resources-namespace.json: |- @@ -4025,7 +4022,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-k8s-resources-namespace - namespace: monitoring - apiVersion: v1 data: k8s-resources-pod.json: |- @@ -4891,7 +4887,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-k8s-resources-pod - namespace: monitoring - apiVersion: v1 data: nodes.json: |- @@ -6003,7 +5998,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-nodes - namespace: monitoring - apiVersion: v1 data: pods.json: |- @@ -6493,7 +6487,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-pods - namespace: monitoring - apiVersion: v1 data: statefulset.json: |- @@ -7346,7 +7339,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-statefulset - namespace: monitoring - apiVersion: v1 data: deployments.json: |- @@ -8260,7 +8252,6 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-deployments - namespace: monitoring - apiVersion: v1 data: k8s-cluster-usage.json: |- @@ -9600,5 +9591,4 @@ items: kind: ConfigMap metadata: name: grafana-dashboard-k8s-cluster-usage - namespace: monitoring kind: ConfigMapList \ No newline at end of file From a28b919f85307f63a9673f32e5becf472c5b54fb Mon Sep 17 00:00:00 2001 From: Camil Blanaru Date: Mon, 13 Aug 2018 22:31:46 +0200 Subject: [PATCH 4/7] Fix namespace in scripts --- tools/grafana_proxy.sh | 3 +++ tools/prometheus_proxy.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tools/grafana_proxy.sh b/tools/grafana_proxy.sh index c5cfabb..c7b5fc5 100755 --- a/tools/grafana_proxy.sh +++ b/tools/grafana_proxy.sh @@ -1,4 +1,7 @@ #!/bin/bash +#Namespace +NAMESPACE=$(kubectl get sts --all-namespaces | grep prometheus-k8s | cut -d " " -f1) + POD=$(kubectl get pods --namespace=$NAMESPACE | grep grafana| cut -d ' ' -f 1) kubectl port-forward $POD --namespace=$NAMESPACE 3000:3000 diff --git a/tools/prometheus_proxy.sh b/tools/prometheus_proxy.sh index ab15a86..d967dcb 100755 --- a/tools/prometheus_proxy.sh +++ b/tools/prometheus_proxy.sh @@ -1,4 +1,7 @@ #!/bin/bash +#Namespace +NAMESPACE=$(kubectl get sts --all-namespaces | grep prometheus-k8s | cut -d " " -f1) + POD=$(kubectl get pods --namespace=$NAMESPACE | grep prometheus-k8s-0| cut -d ' ' -f 1) kubectl port-forward $POD --namespace=$NAMESPACE 9090:9090 From ae5a3ca738ea37b3afb854a5db43705a1acdc009 Mon Sep 17 00:00:00 2001 From: Camil Blanaru Date: Mon, 13 Aug 2018 22:50:25 +0200 Subject: [PATCH 5/7] Fix teardown script --- .../prometheus-operator-cluster-role-binding.yaml | 1 + teardown | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml b/manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml index bdbbde2..888b239 100644 --- a/manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml +++ b/manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: prometheus-operator + namespace: CUSTOM_NAMESPACE --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole diff --git a/teardown b/teardown index 40f9b84..7cb2e48 100755 --- a/teardown +++ b/teardown @@ -36,7 +36,8 @@ kubectl delete -f manifests/k8s/self-hosted # Hack: wait a bit to let the controller delete the deployed Prometheus server. sleep 5 -kctl delete -f manifests/prometheus-operator +find manifests/prometheus-operator -type f ! -name prometheus-operator-cluster-role-binding.yaml -exec kubectl --namespace "$NAMESPACE" delete -f {} \; +kubectl delete -f manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml kctl delete secret grafana-credentials From 2f90e0aaa992a8b23891f9d85bc05251bd71f981 Mon Sep 17 00:00:00 2001 From: Camil Blanaru Date: Mon, 13 Aug 2018 23:20:01 +0200 Subject: [PATCH 6/7] Update manifests with custom namespace --- deploy | 7 +++---- manifests/grafana/grafana-datasources.cm.yaml | 2 +- .../prometheus-k8s-service-monitor-alertmanager.yaml | 2 +- .../prometheus-k8s-service-monitor-kube-state-metrics.yaml | 2 +- .../prometheus-k8s-service-monitor-node-exporter.yaml | 2 +- .../prometheus-k8s-service-monitor-prometheus.yaml | 2 +- .../prometheus-k8s-service-monitor-apiserver.yaml | 2 +- teardown | 7 +++---- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/deploy b/deploy index 68d3b5c..570bd0c 100755 --- a/deploy +++ b/deploy @@ -60,10 +60,9 @@ echo -e "${BLUE}Creating ${ORANGE}${NAMESPACE} ${BLUE}namespace." kubectl create namespace "$NAMESPACE" #Set namespace in various resources -sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/kube-state-metrics/kube-state-metrics-rbac.yaml -sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s-rbac.yaml -sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s.yaml -sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml +for n in $(egrep -lir --include=*.{yaml,sh} "CUSTOM_NAMESPACE" .); do + sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' $n +done kctl() { kubectl --namespace "$NAMESPACE" "$@" diff --git a/manifests/grafana/grafana-datasources.cm.yaml b/manifests/grafana/grafana-datasources.cm.yaml index a0c03d7..6d8bcf5 100644 --- a/manifests/grafana/grafana-datasources.cm.yaml +++ b/manifests/grafana/grafana-datasources.cm.yaml @@ -13,7 +13,7 @@ data: "name": "prometheus", "orgId": 1, "type": "prometheus", - "url": "http://prometheus-k8s.monitoring.svc:9090", + "url": "http://prometheus-k8s.CUSTOM_NAMESPACE.svc:9090", "version": 1 } ] diff --git a/manifests/prometheus/prometheus-k8s-service-monitor-alertmanager.yaml b/manifests/prometheus/prometheus-k8s-service-monitor-alertmanager.yaml index 19669e3..a3724e3 100644 --- a/manifests/prometheus/prometheus-k8s-service-monitor-alertmanager.yaml +++ b/manifests/prometheus/prometheus-k8s-service-monitor-alertmanager.yaml @@ -10,7 +10,7 @@ spec: alertmanager: main namespaceSelector: matchNames: - - monitoring + - CUSTOM_NAMESPACE endpoints: - port: web interval: 30s diff --git a/manifests/prometheus/prometheus-k8s-service-monitor-kube-state-metrics.yaml b/manifests/prometheus/prometheus-k8s-service-monitor-kube-state-metrics.yaml index 6563a4d..baedf7e 100644 --- a/manifests/prometheus/prometheus-k8s-service-monitor-kube-state-metrics.yaml +++ b/manifests/prometheus/prometheus-k8s-service-monitor-kube-state-metrics.yaml @@ -11,7 +11,7 @@ spec: k8s-app: kube-state-metrics namespaceSelector: matchNames: - - monitoring + - CUSTOM_NAMESPACE endpoints: - port: http-metrics interval: 30s diff --git a/manifests/prometheus/prometheus-k8s-service-monitor-node-exporter.yaml b/manifests/prometheus/prometheus-k8s-service-monitor-node-exporter.yaml index e1b083b..555565a 100644 --- a/manifests/prometheus/prometheus-k8s-service-monitor-node-exporter.yaml +++ b/manifests/prometheus/prometheus-k8s-service-monitor-node-exporter.yaml @@ -11,7 +11,7 @@ spec: k8s-app: node-exporter namespaceSelector: matchNames: - - monitoring + - CUSTOM_NAMESPACE endpoints: - port: http-metrics interval: 30s diff --git a/manifests/prometheus/prometheus-k8s-service-monitor-prometheus.yaml b/manifests/prometheus/prometheus-k8s-service-monitor-prometheus.yaml index c3d11e5..200a7f0 100644 --- a/manifests/prometheus/prometheus-k8s-service-monitor-prometheus.yaml +++ b/manifests/prometheus/prometheus-k8s-service-monitor-prometheus.yaml @@ -10,7 +10,7 @@ spec: prometheus: k8s namespaceSelector: matchNames: - - monitoring + - CUSTOM_NAMESPACE endpoints: - port: web interval: 30s diff --git a/manifests/prometheus/self-hosted/prometheus-k8s-service-monitor-apiserver.yaml b/manifests/prometheus/self-hosted/prometheus-k8s-service-monitor-apiserver.yaml index afd574b..40361f0 100644 --- a/manifests/prometheus/self-hosted/prometheus-k8s-service-monitor-apiserver.yaml +++ b/manifests/prometheus/self-hosted/prometheus-k8s-service-monitor-apiserver.yaml @@ -12,7 +12,7 @@ spec: provider: kubernetes namespaceSelector: matchNames: - - kube-system + - default endpoints: - port: https interval: 30s diff --git a/teardown b/teardown index 7cb2e48..47ff4a7 100755 --- a/teardown +++ b/teardown @@ -20,10 +20,9 @@ kctl() { } #Set namespace in various resources -sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/kube-state-metrics/kube-state-metrics-rbac.yaml -sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s-rbac.yaml -sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s.yaml -sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml +for n in $(egrep -lir --include=*.{yaml,sh} "CUSTOM_NAMESPACE" .); do + sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' $n +done kctl delete -f manifests/node-exporter kctl delete -f manifests/kube-state-metrics From ad0df1a4806ef7495b7e6e0dcb847d5bd050370b Mon Sep 17 00:00:00 2001 From: Camil Blanaru Date: Mon, 13 Aug 2018 23:23:46 +0200 Subject: [PATCH 7/7] Small fix on instruction to delete PVC --- teardown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teardown b/teardown index 47ff4a7..636f18f 100755 --- a/teardown +++ b/teardown @@ -53,7 +53,7 @@ kubectl get crd -o 'jsonpath={.items[*].metadata.name}' | xargs -n 1 | fgrep cor #manually remove persistent volumes instructions echo -e "${GREEN}The persistent volumes for Grafana and Prometeus were not removed!" echo -e "${GREEN}To remove them, please run te following command:" -echo -e "${WHITE}kubectl get pvc -n ${NAMESPACE} | grep 'grafana\|prometheus' | cut -d " " -f 1 | xargs -n 1 kubectl delete pvc -n ${NAMESPACE}" +echo -e "${WHITE}kubectl get pvc -n ${NAMESPACE} | grep 'grafana\|prometheus' | cut -d '" "' -f 1 | xargs -n 1 kubectl delete pvc -n ${NAMESPACE}" #clean sed generated files find . -name "*.yaml-e" -exec rm -rf {} \;