Skip to main content

Posts

Showing posts from November 27, 2019

Prometheus Alertmanager integration by routing to slack using helm

Setting up Alertmanager and Rules --------------------------------- Now that you have prometheus set up, you need to specify some instructions. The next step is to create a values.yaml file that specifies 1) what the alert rules are, 2) what the Prometheus targets are (i.e the definition of what to scrape and how) and any jobs for Prometheus, and 3) where alerts should be routed to (in this case, Slack). Alert Rules ------------ vi prometheus.values ## Prometheus server ConfigMap entries ## serverFiles:   ## Alerts configuration   ## Ref: https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/   alerts:     groups:       - name: Instances         rules:           - alert: InstanceDown             expr: up == 0             for: 5m             labels:               severity: page             annotations:               description: '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.'          

Prometheus Monitoring Setup in K8s cluster with Grafana for GUI

Prometheus setup ################ Prerequisites: -------------- > PV & PVC setup with NFS. >> https://jinojoseph.blogspot.com/2019/11/persistent-volume-in-k8s-multinode.html > helm setup with tiller. >> https://jinojoseph.blogspot.com/2019/10/setting-up-helm-chart-for-k8s-cluster.html git clone https://github.com/jinojosep/k8s.git cd k8s/prometheus vi 1.6-deployments.yaml Replace the values of NFS_SERVER & NFS_PATH NFS_SERVER : 10.0.1.9 NFS_PATH : /srv/nfs/k8sdata vi 1.6-class.yaml Add the below line in the metadata:   annotations:     storageclass.kubernetes.io/is-default-class: "true"   # ubuntu@namenode:~/myk8syamls/nfs-provisioner$ kubectl create -f rbac.yaml -f 1.6-class.yaml -f 1.6-deployment.yaml serviceaccount/nfs-client-provisioner created clusterrole.rbac.authorization.k8s.io/nfs-client-provisioner-runner created clusterrolebinding.rbac.authorization.k8s.io/run-nfs-client-provisioner created role.rbac.auth

Dockerfile for Java Openjdk / Node Js / Python and many more.

FROM openjdk:8 # Add Maintainer Info LABEL maintainer="jinojoseph@ndimensions.com" # Add a volume pointing to /tmp VOLUME /tmp # The application's jar file ARG JAR_FILE=/home/ubuntu/YourJarFileNOV7.jar # Add the application's jar to the container COPY ${JAR_FILE} app.jar # Run the jar file ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] COPY --from=python:3.6 / / ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn RUN set -e; \      apt-get update; \      apt-get install -y --no-install-recommends \         software-properties-common \     ; \      apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9; \      apt-add-repository 'deb http://repos.azulsystems.com/debian stable main'; \      apt-get update; \      apt-get install -y --no-install-recommends \         zulu-8 \     ; \      apt-get clean; \     rm -rf /var/tmp/* /tm