- Install nginx-ingress with helm chart
- Fetch Prometheus helm chart and set custom values
- Play with Prometheus targets
- Set to collect data from kube-state-metrics, node-exporters
- Set service discovery for reddit microservices pods
- Play with relabels
- Install Grafana with helm chart
- Play with Grafana dashboards
- Using Grafana templating capabilities
- (*) - set Alermanager parameter in
custom_values.yml
to send notifications to Slack when nodes or api-server is unavailable - (*) - install Prometheus Operator, set ServiceMonitor to
post
endpointhelm install --namespace monitoring --name prom-operator stable/prometheus-operator
kubectl apply -f kubernetes/prometheus-operator-servicemonitors/post-servicemonitor.yml
- Bootstrap EFK stack
- (*) bootstrap EFK stack using helm charts
helm repo add elastic https://helm.elastic.co
helm install --namespace logging --name elasticsearch -f kubernetes/Charts/EFK/elasticsearch_custom_values.yaml elastic/elasticsearch
helm install --namespace logging --name kibana -f kubernetes/Charts/EFK/kibana_custom_values.yaml elastic/kibana
helm install --namespace logging --name fluend stable/fluentd
- Helm - charts, templates, helpers, dependencies
- Tiller plugin
- Helm3
- GitLab - bootsrap from helm chart
- Push reddit microservices repos to GitLab
- GitLab CI
- (*) - use pipline triggering by call
curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master $CI_API_V4_URL/projects/1/trigger/pipeline
in end ofrelease
joib of each microservice
- Services, kube-dns, nodePort, LoadBalancer, Ingress
- Secret, TLS Termination)
- (*) manifest with secret for UI Ingress -
kubernetes/reddit/ui-ingress-secret.yml
- Network Policy
- Volumes, PV, PVC, StorageClass
- Install
kubectl
- Install
Minikube
- Start Minikube cluster
- Inspect
kubectl
context - Prepare reddit-app k8s mainfests - deployments, services
- Play with namespaces
- Setup Kubernetes Dashboard
- Start GKE cluster
- (*) - bootstrap GKE cluster using Terraform (
kubernetes/terraform
) - (*) - access to Kubernetes Dashboard:
- install Dashboard -
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
- create ServiceAccount and ClusterRoleBinding
kubectl apply -f dashboard/dashboard-adminuser.yaml
- Get dasboard access token -
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
- install Dashboard -
- Describe reddit-app in Kubernetes manifests
- Walked through Kubernetes The Hard Way
- (*/2) - try not so hard way, using prepared ansible playbooks:
git clone [email protected]:zlbabe/Kubernetes-the-hard-way-with-Ansible.git
cd Kubernetes-the-hard-way-with-Ansible
vagrant up
ansible-playbook k8s.yml
Docker images placed in https://hub.docker.com/u/bars83/
- Update reddit-app to looging-ready code
- Add docker-compose-logging.yml to describe EFK (Elasticsearch+Fluentd+Kibana) services
- Play with EFK structured logs
- Set unstructured logs parsing
- (*) - add fluentd
grok
pattern to parse UI service logs - Using Zipkin distributed tracing system
- (*) - on bugged-code Zipin traicing shows 3sec delay while getting post in
post
service. It seem that developer forget to removetime.sleep(3)
on line 167 of post-py/post_app.py. Zipkin tracing was very helpful to find this botleneck.
- Separate docker-compose-monitoring.yml from base docker-compose file
- Using cAdvisor to monitor docker containers
- Using Grafana to metrics visualization - using dashboards from grafana.com, building custom dashboards
- Using Alermanager for metrics alerting in Slack channel
- (*) - update Makefile with new services
- (*) - get Docker daemon metrics https://medium.com/p/e02a6a5745a/responses/show), add Grafana dashboard (id=1229)
- (*) - using Telegraf to export Docker daemon metrics
- (*) - set up Alertmanager rule to fire on too high response latency of UI service by 95th percentile
- (**) - provision Grafana datasource and dashboards on container startup
- (***) - proxy Grafana to Prometheus requests with Trickster for caching
- Run Prometheus container
- Monitoring Reddit microsevices with Prometheus
- Using Node Exporter to get host metrics
- (*) - MongoDB monitoring using https://github.com/percona/mongodb_exporter
- (*) - play with Blackbox exporter (https://github.com/prometheus/blackbox_exporter)
- (*) - play with Cloudprober exporter
- (*) - add Makefile to automate images preparing, building and pushing
- Bootsrap Gitlab with docker-compose
- Setup Gitlab - create group and projects
- Add Gitlab as remote for our microservices projects
- Play with CI pipelines
- Play with gitlab environments (static and dynamic)
- (* task) - edit "build" job for docker image building
- (** task) - provision gitlab runner with ansible using gcp inventory (iaac in
gitlab-ci/infra
) - (** task) - configure Slack notifications for Gitlab pipeline events
- Working with different docker network types - none, host, bridge
- Use docker-compose to run containerized reddit app
- Docker compose default project name use current folder and folder with service description names. To set docker-compose project name use
-p
parameter, e.g.:docker-compose -p reddit up -d
- Write docker-compose.override.yml to override some service parameters (e.g. volumes, commands)
- Write Dockerfile for each service
- Using ENV (-e) on
docker run
command- e.g.
docker run -d --network=reddit --network-alias=my_comment -e COMMENT_ DATABASE_HOST=my_comment_db <your-dockerhub-login>/comment:2.0
- e.g.
- Use apline-based images to optimize srvices images
- Use docker volume to store state
- Use hadolint for Dockerfile's linting:
- e.g.
docker run --rm -i hadolint/hadolint < ./comment/Dockerfile
- e.g.
- Playing with docker
- Using docker-machine with GCE
-
-
- IaaC using Ansible+Packer+Terrafor to start dockerized reddit-app in GCE
-