Work In Progress (WIP)
This project was inspired by kube-prometheus bundle but instead of use jsonnet to customize and configure it, this use kustomize to overlay Kubernetes manifests and kpt to distribute it as a package.
Also, this is GitOps friendly.
This kpt package will install the following software list into your Kubernetes cluster
NOTES:
- kubernetes-mixin provides some prometheus rules and dashboards.
Used Tools
Project | License |
---|---|
kpt | Apache License 2.0 |
kustomize | Apache License 2.0 |
>= 1.19.x
The layout structure for this project is simple, the pkg folder contains the kpt blueprint implementation of kube-visibility, which is separate from the root of git project intentionally to avoid unnecessary files into the package when you install it using kpt pkg get command. The root folder could contain additional docs, examples, and CI/CD pipeline definitions.
The heart of this project are these two tools, so if you want to contribute with it you need to understand and manage it.
and of course, it is was possible thanks to the big and great idea of kube-prometheus project.
To install this kpt package you just need to know about KPT Package Consumers , but in short:
kpt pkg get https://github.com/slashdevops/kube-visibility/pkg@master kube-visibility
NOTE: Remember the pkg folder
into the git path
Looks inside HowTos folder for more detailed information about how to prepare minikube
MacOS
minikube delete
minikube config set memory 6144
minikube config set cpus 2
minikube config set disk-size 40G
minikube config set vm-driver docker
minikube config set kubernetes-version 1.19.8
minikube config view
minikube start
minikube status
Linux
# set
minikube config set memory 6144 # > much better
minikube config set cpus 2 # > much better
minikube config set disk-size 40G
minikube config set vm-driver kvm2 # for linux, for MacOS see HowTos/ folder
minikube config set kubernetes-version 1.19.8
minikube config view
# start
minikube start
# check
minikube status
Install kubernetes dashboard
# OPTIONAL, EXECUTE IT IN DIFFERENT TERMINAL
# I recommended it to see what is happening inside your cluster
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.3.1/aio/deploy/recommended.yaml
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:default
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep default | awk '{print $1}')
kubectl proxy
# then, open the following link in your browser: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy
Download and install the kpt pkg
from master branch
or the specify the release tag
, more information here Command Reference / pkg / get
Install kpt
brew tap GoogleContainerTools/kpt https://github.com/GoogleContainerTools/kpt.git
brew install kpt
Install kube-visibility
mkdir k8s-workspace
cd k8s-workspace/
kpt pkg get https://github.com/slashdevops/kube-visibility/pkg@master kube-visibility
# OPTIONAL, using git
git init .
git add .
git commit -am "added kube-visibility tool"
# OPTIONAL, using kpt live
kpt live init kube-visibility/
# OPTIONAL, list available kpt setters
kpt cfg list-setters kube-visibility/
# OPTIONAL, change one setter
kpt cfg set kube-visibility/ alertmanager.resources-limits-cpu 120m
# INSTALL, install kube-visibility manifests
# WORKAROUND, until kpt avoid problems with json and yaml files that not are part of k8s 'kind'
# Apply the manifest bundle to the cluster
# NOTE 1: the first time you execute this command some errors appears at the end, wait until
# prometheus-operator is up before apply again! (see the NOTE below).
# to see it, use the command 'kubectl get pod --all-namespaces' or just see in the kubernetes-dashboard (step above)
# NOTE 2: The second time you apply this command, they are take to long, because depending prometheus CRDs are big!
kustomize build kube-visibility/instance | kubectl apply -f -
# OPTIONAL, depend on 'kpt live init'
# kpt live apply kube-visibility/ --reconcile-timeout=10m
NOTE: The bundle of manifest generated with kustomize has some dependencies with each other (prometheus depends on prometheus-operator and needs that it was created first), so when you execute the first time the manifest, some errors will occur. After the first execution you need to wait until some resources were created, and then you can execute again the command to create the resources into the k8s cluster. If you are using the kubernetes-dashboard you can watch when the first execution finished creating the resources, and then you can execute it again to finish with the installation.
All these tools are accessible (using the method described below) when you follow the instructions described in HowTos folder for minikube
Reference: https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.3.1/aio/deploy/recommended.yaml
Create a RoleBinding to kube-system namespace default ServiceAccount
to access to the dashboard as ClusterAdmin
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:default
# get the token
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep default | awk '{print $1}')
# Execute it in a different terminal
kubectl proxy
Link: Kubernetes Dashboard --> http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy
# Execute it in a different terminal
kubectl --namespace kube-visibility port-forward svc/prometheus-visibility 9090
Link: prometheus --> http://localhost:9090
# Execute it in a different terminal
kubectl --namespace kube-visibility port-forward svc/alertmanager-visibility 9093
Link: alertmanager --> http://localhost:9093
# Execute it in a different terminal
kubectl --namespace kube-visibility port-forward svc/grafana 3000
Link: grafana --> http://localhost:3000
- user: admin
- password: admin
WIP, but at least
If you want to contribute to this project do the following
- Fork the project
- Clone the Forked repository
- Create a
custom branch
or work ondevelop branch
- Create your custom
manifests/modifiers
orgrafana dashboard
or fix some bug what did you find - Merge and push your changes to the
custom branch
ordevelop
branch in your forked repository - Create a Pull Request to official project
develop
branch - Wait until your
PR
to be approved and merged to themaster branch
References
This module is released under the Apache License Version 2: