diff --git a/kubernetes-deploy.sh b/kubernetes-deploy.sh index 2fa3df4..daade8c 100755 --- a/kubernetes-deploy.sh +++ b/kubernetes-deploy.sh @@ -1,4 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash + +cwd=$(cd "${0%/*}"; pwd) # create 12-factor-app namespace kubectl create namespace 12-factor-app @@ -6,7 +8,7 @@ kubectl create namespace 12-factor-app # install OTel Operator helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts helm repo update -helm install my-opentelemetry-operator open-telemetry/opentelemetry-operator \ +helm upgrade --install my-opentelemetry-operator open-telemetry/opentelemetry-operator \ --set "manager.collectorImage.repository=otel/opentelemetry-collector-contrib" \ --set admissionWebhooks.certManager.enabled=false \ --namespace opentelemetry \ @@ -15,7 +17,7 @@ helm install my-opentelemetry-operator open-telemetry/opentelemetry-operator \ --wait # create OTel collector and instrumentation -kubectl apply -f otel/. +kubectl apply -f $cwd/otel/ # install cert-manager OPTIONAL helm repo add jetstack https://charts.jetstack.io @@ -28,32 +30,41 @@ helm upgrade --install \ --set installCRDs=true \ --wait -# install jaeger (requires cert-manager) OPTIONAL kubectl create namespace observability + helm repo add jaegertracing https://jaegertracing.github.io/helm-charts helm repo update -helm install jaeger jaegertracing/jaeger-operator -n observability --wait -kubectl apply -f jaeger/. +helm upgrade --install jaeger jaegertracing/jaeger-operator \ + --namespace observability \ + --wait +kubectl apply -f $cwd/jaeger/. -# install prometheus OPTIONAL helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update -helm install prometheus prometheus-community/kube-prometheus-stack \ +helm upgrade --install prometheus prometheus-community/kube-prometheus-stack \ --version 51.3.0 \ --namespace observability \ - --values prometheus/kube-prometheus-stack-values.yaml \ + --values $cwd/prometheus/kube-prometheus-stack-values.yaml \ --wait -kubectl apply -f ./prometheus/ingress.yaml +kubectl apply -f $cwd/prometheus/ingress.yaml -# install elastic (requires namespace 'observability') OPTIONAL helm repo add elastic https://helm.elastic.co helm repo update -helm install elasticsearch elastic/elasticsearch --version 7.17.3 -n observability --set replicas=1 --wait -helm install kibana elastic/kibana --version 7.17.3 -n observability --wait -kubectl apply -f ./fluent/fluentd-config-map.yaml -kubectl apply -f ./fluent/fluentd-dapr-with-rbac.yaml +helm upgrade --install elasticsearch elastic/elasticsearch \ + --version 7.17.3 \ + --namespace observability \ + --set replicas=1 \ + --wait + +helm upgrade --install kibana elastic/kibana \ + --version 7.17.3 \ + --namespace observability \ + --wait + +kubectl apply -f $cwd/fluent/fluentd-config-map.yaml +kubectl apply -f $cwd/fluent/fluentd-dapr-with-rbac.yaml kubectl wait --for=condition=ready pod --all --timeout=200s -n observability -kubectl apply -f ./fluent/ingress.yaml +kubectl apply -f $cwd/fluent/ingress.yaml # install dapr helm repo add dapr https://dapr.github.io/helm-charts/ @@ -65,22 +76,26 @@ helm upgrade --install dapr dapr/dapr \ --wait # install dapr dashboard OPTIONAL -helm install dapr-dashboard dapr/dapr-dashboard --namespace dapr-system --wait +helm upgrade --install dapr-dashboard dapr/dapr-dashboard \ + --namespace dapr-system \ + --wait # install redis helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update -helm install redis bitnami/redis --namespace 12-factor-app --wait +helm upgrade --install redis bitnami/redis \ + --namespace 12-factor-app \ + --wait # deploy the 12-factor-app -kubectl apply -f kubernetes/. +kubectl apply -f $cwd/kubernetes/. kubectl wait --for=condition=ready pod --all --timeout=200s -n 12-factor-app # setup locust for load generation OPTIONAL kubectl create configmap my-loadtest-locustfile --from-file locust/main.py -n 12-factor-app helm repo add deliveryhero https://charts.deliveryhero.io/ helm repo update -helm install locust deliveryhero/locust \ +helm upgrade --install locust deliveryhero/locust \ --set loadtest.name=my-loadtest \ --set loadtest.locust_locustfile_configmap=my-loadtest-locustfile \ --set loadtest.locust_host=http://controller.12-factor-app:3000 \ @@ -88,9 +103,10 @@ helm install locust deliveryhero/locust \ --set loadtest.environment.LOCUST_AUTOSTART="true" \ --namespace 12-factor-app \ --wait -kubectl apply -f locust/ingress.yaml +kubectl apply -f $cwd/locust/ingress.yaml # get redis password (for manual interactions with the redis cli) OPTIONAL redis_pwd=$(kubectl get secret redis -n 12-factor-app -o jsonpath='{.data.redis-password}' | base64 --decode) + echo The redis password is $redis_pwd echo To authenticate use: redis-cli -a $redis_pwd \ No newline at end of file