setup ingress-nginx

parse ingress logs towards opensearch

know your runtime engine

you need to know if you’re using docker or cri engine – we will use cri here

#minikube delete --all
minikube start --driver=docker --container-runtime=containerd
# --container-runtime=containerd
# --container-runtime=cri-o
# --container-runtime=docker

check that you will get the CRI format with containerd (last column)

kubectl get nodes -o wide
# docker://24.0.4
# containerd://1.6.21

minikube ssh

pgrep -a kubelet
# --container-runtime-endpoint=unix:///var/run/cri-dockerd.sock
# --container-runtime-endpoint=unix:///run/containerd/containerd.sock
^D

app setup

#kubectl create deploy web --image=gcr.io/google-samples/hello-app:1.0
#kubectl expose deploy web --type=ClusterIP --port=8080

kubectl create deploy web --image=pbraun9/sabotage-nginx-debug:latest
kubectl expose deploy web --type=ClusterIP --port=80

kubectl get deploy -o wide
kubectl get svc -o wide
kubectl describe endpoints web

ingress setup

minikube addons enable ingress
kubectl get pods -n ingress-nginx

vi ingress-logtest.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-logtest
spec:
  rules:
    - host: hello-world.info
      http:
    paths:
      - path: /
        pathType: Prefix
        backend:
          service:
        name: web
        port:
          number: 80
kubectl apply -f ingress-logtest.yaml
kubectl get ingress

custom log format (optional)

see k8s-ingress-custom

acceptance

see k8s-ingress-logs-acceptance

ready to go

you can now proceed with data-stream setup and fluent-bit

resources

https://opensearch.org/docs/latest/dashboards/dql

https://fluentbit.io/blog/2021/01/25/logging-fluentd-with-kubernetes/

https://serverfault.com/questions/862308/how-do-i-view-logs-for-my-kubernetes-ingress-controller ==> kubectl logs -l

https://www.nginx.com/blog/guide-to-choosing-ingress-controller-part-4-nginx-ingress-controller-options/ ==> ingress-nginx vs. kubernetes-ingress

engine

https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/find-out-runtime-you-use/

https://minikube.sigs.k8s.io/docs/handbook/config/

https://minikube.sigs.k8s.io/docs/runtimes/


https://stackoverflow.com/questions/54314250/gzip-in-gke-with-nginx-ingress

https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/

https://stackoverflow.com/questions/15999606/enable-gzip-compression-with-nginx

https://github.com/google/ngx_brotli


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun