Loading deploy/tfs.sh +18 −9 Original line number Diff line number Diff line Loading @@ -338,17 +338,12 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]]; then echo "Configuring WebUI DataStores and Dashboards..." sleep 5 # INGRESS_CTRL_NAME=$(echo "${TFS_K8S_NAMESPACE}" | sed "s/tfs/nginx-ingress-microk8s-controller/g") # EXT_HTTP_PORT=$(kubectl get daemonsets.apps --namespace ingress ${INGRESS_CTRL_NAME} \ # -o 'jsonpath={.spec.template.spec.containers[?(@.name=="nginx-ingress-microk8s")].ports[?(@.name=="http")].hostPort}') # get IP and port of grafana in the `monitoring` namespace GRAFANA_IP=$(kubectl get service/grafana -n monitoring -o jsonpath='{.spec.clusterIP}') #GRAFANA_PORT=3000 #$(kubectl get service webuiservice --namespace $TFS_K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}') INGRESS_CTRL_NAME=$(echo "${TFS_K8S_NAMESPACE}" | sed "s/tfs/nginx-ingress-microk8s-controller/g") EXT_HTTP_PORT=$(kubectl get daemonsets.apps --namespace ingress ${INGRESS_CTRL_NAME} \ -o 'jsonpath={.spec.template.spec.containers[?(@.name=="nginx-ingress-microk8s")].ports[?(@.name=="http")].hostPort}') # Exposed through the ingress controller "tfs-ingress" # GRAFANA_URL="127.0.0.1:${EXT_HTTP_PORT}/grafana" GRAFANA_URL="${GRAFANA_IP}:${GRAF_EXT_PORT_HTTP}" GRAFANA_URL="127.0.0.1:${EXT_HTTP_PORT}/grafana" # Default Grafana credentials when installed with the `monitoring` addon GRAFANA_USERNAME="admin" Loading Loading @@ -429,6 +424,20 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]]; then }' ${GRAFANA_URL_UPDATED}/api/datasources printf "\n\n" # adding the datasource of the metrics collection framework curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{ "access" : "proxy", "type" : "prometheus", "name" : "Prometheus", "url" : "http://prometheus-k8s.monitoring.svc:9090", "basicAuth": false, "isDefault": false, "jsonData" : { "httpMethod" : "POST" } }' ${GRAFANA_URL_UPDATED}/api/datasources printf "\n\n" echo ">> Creating dashboards..." # Ref: https://grafana.com/docs/grafana/latest/http_api/dashboard/ curl -X POST -H "Content-Type: application/json" -d '@src/webui/grafana_db_mon_kpis_psql.json' \ Loading manifests/webuiservice.yaml +37 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,43 @@ spec: limits: cpu: 500m memory: 512Mi - name: grafana image: grafana/grafana:8.5.22 imagePullPolicy: IfNotPresent ports: - containerPort: 3000 name: http-grafana protocol: TCP env: - name: GF_SERVER_ROOT_URL value: "http://0.0.0.0:3000/grafana/" - name: GF_SERVER_SERVE_FROM_SUB_PATH value: "true" readinessProbe: failureThreshold: 3 httpGet: path: /robots.txt port: 3000 scheme: HTTP initialDelaySeconds: 10 periodSeconds: 30 successThreshold: 1 timeoutSeconds: 2 livenessProbe: failureThreshold: 3 initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 1 tcpSocket: port: 3000 timeoutSeconds: 1 resources: requests: cpu: 150m memory: 512Mi limits: cpu: 500m memory: 1024Mi --- apiVersion: v1 kind: Service Loading Loading
deploy/tfs.sh +18 −9 Original line number Diff line number Diff line Loading @@ -338,17 +338,12 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]]; then echo "Configuring WebUI DataStores and Dashboards..." sleep 5 # INGRESS_CTRL_NAME=$(echo "${TFS_K8S_NAMESPACE}" | sed "s/tfs/nginx-ingress-microk8s-controller/g") # EXT_HTTP_PORT=$(kubectl get daemonsets.apps --namespace ingress ${INGRESS_CTRL_NAME} \ # -o 'jsonpath={.spec.template.spec.containers[?(@.name=="nginx-ingress-microk8s")].ports[?(@.name=="http")].hostPort}') # get IP and port of grafana in the `monitoring` namespace GRAFANA_IP=$(kubectl get service/grafana -n monitoring -o jsonpath='{.spec.clusterIP}') #GRAFANA_PORT=3000 #$(kubectl get service webuiservice --namespace $TFS_K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}') INGRESS_CTRL_NAME=$(echo "${TFS_K8S_NAMESPACE}" | sed "s/tfs/nginx-ingress-microk8s-controller/g") EXT_HTTP_PORT=$(kubectl get daemonsets.apps --namespace ingress ${INGRESS_CTRL_NAME} \ -o 'jsonpath={.spec.template.spec.containers[?(@.name=="nginx-ingress-microk8s")].ports[?(@.name=="http")].hostPort}') # Exposed through the ingress controller "tfs-ingress" # GRAFANA_URL="127.0.0.1:${EXT_HTTP_PORT}/grafana" GRAFANA_URL="${GRAFANA_IP}:${GRAF_EXT_PORT_HTTP}" GRAFANA_URL="127.0.0.1:${EXT_HTTP_PORT}/grafana" # Default Grafana credentials when installed with the `monitoring` addon GRAFANA_USERNAME="admin" Loading Loading @@ -429,6 +424,20 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]]; then }' ${GRAFANA_URL_UPDATED}/api/datasources printf "\n\n" # adding the datasource of the metrics collection framework curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{ "access" : "proxy", "type" : "prometheus", "name" : "Prometheus", "url" : "http://prometheus-k8s.monitoring.svc:9090", "basicAuth": false, "isDefault": false, "jsonData" : { "httpMethod" : "POST" } }' ${GRAFANA_URL_UPDATED}/api/datasources printf "\n\n" echo ">> Creating dashboards..." # Ref: https://grafana.com/docs/grafana/latest/http_api/dashboard/ curl -X POST -H "Content-Type: application/json" -d '@src/webui/grafana_db_mon_kpis_psql.json' \ Loading
manifests/webuiservice.yaml +37 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,43 @@ spec: limits: cpu: 500m memory: 512Mi - name: grafana image: grafana/grafana:8.5.22 imagePullPolicy: IfNotPresent ports: - containerPort: 3000 name: http-grafana protocol: TCP env: - name: GF_SERVER_ROOT_URL value: "http://0.0.0.0:3000/grafana/" - name: GF_SERVER_SERVE_FROM_SUB_PATH value: "true" readinessProbe: failureThreshold: 3 httpGet: path: /robots.txt port: 3000 scheme: HTTP initialDelaySeconds: 10 periodSeconds: 30 successThreshold: 1 timeoutSeconds: 2 livenessProbe: failureThreshold: 3 initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 1 tcpSocket: port: 3000 timeoutSeconds: 1 resources: requests: cpu: 150m memory: 512Mi limits: cpu: 500m memory: 1024Mi --- apiVersion: v1 kind: Service Loading