Photo by Luke Chesser on Unsplash

Logging V Monitoring: Part 1

Introduction

Logging vs Monitoring

Can’t Have One Without the Other

Monitoring

Monitoring Example Project

kubectl apply -f https://download.elastic.co/downloads/eck/1.3.1/all-in-one.yaml# Monitor the output from the operator
kubectl -n elastic-system logs -f statefulset.apps/elastic-operator
cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: quickstart
spec:
version: 7.10.2
nodeSets:
- name: default
count: 1
config:
node.store.allow_mmap: false
EOF
# Wait for the cluster to go green
kubectl get elasticsearch
cat <<EOF | kubectl apply -f -
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
name: quickstart
spec:
version: 7.10.2
count: 1
elasticsearchRef:
name: quickstart
EOF
# Get information about the kibana deployment
kubectl get kibana
cat <<EOF | kubectl apply -f -
apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
name: quickstart
spec:
type: filebeat
version: 7.10.2
elasticsearchRef:
name: quickstart
config:
filebeat.inputs:
- type: container
paths:
- /var/log/containers/*.log
daemonSet:
podTemplate:
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
securityContext:
runAsUser: 0
containers:
- name: filebeat
volumeMounts:
- name: varlogcontainers
mountPath: /var/log/containers
- name: varlogpods
mountPath: /var/log/pods
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
volumes:
- name: varlogcontainers
hostPath:
path: /var/log/containers
- name: varlogpods
hostPath:
path: /var/log/pods
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
EOF
# Wait for the beat to go green
kubectl get beat

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store