默认用当前 master 分支版本,需要指定版本 请参考官方
promethous
1 | git clone https://github.com/prometheus-operator/kube-prometheus.git |
helm 安装 promethous
1 | # helm repo add 添加一个 Helm repo |
dashboard
1 | https://github.com/kubernetes/dashboard |
或者1
2
3kubectl create sa dashboard-admin -n kube-system
kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
获取令牌1
2
3ADMIN_SECRET=$(kubectl get secrets -n kubernetes-dashboard | grep dashboard-token | awk '{print $1}')
DASHBOARD_LOGIN_TOKEN=$(kubectl describe secret -n kubernetes-dashboard ${ADMIN_SECRET} | grep -E '^token' | awk '{print $2}')
echo ${DASHBOARD_LOGIN_TOKEN}
EFK
https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/fluentd-elasticsearch
主要是下载这几个文件1
github : https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/fluentd-elasticsearch
示例1
2
3
4
5
6
7
8
9wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/create-logging-namespace.yaml
wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/es-service.yaml
wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/es-statefulset.yaml
wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/fluentd-es-configmap.yaml
wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/fluentd-es-ds.yaml
wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/kibana-deployment.yaml
wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/kibana-service.yaml
create-logging-namespace.yaml es-service.yaml es-statefulset.yaml fluentd-es-configmap.yaml fluentd-es-ds.yaml kibana-deployment.yaml kibana-service.yaml
fluentd-es-ds.yaml 需要给部署的节点打上标签 2021/04/15 默认配置不需要1
2kubectl label node k8s01 beta.kubernetes.io/fluentd-ds-ready=true
kubectl label node k8s02 beta.kubernetes.io/fluentd-ds-ready=true
kibana-deployment.yaml1
2
3
4
5# 文件下面两行,否则会因为无效的证书颁发机构无法访问 tls: unknown certificate authorit
#- name: SERVER_BASEPATH
# value: /api/v1/namespaces/kube-system/services/kibana-logging/proxy
es-statefulset.yaml
默认使用 emptyDir 可以改为 pv/pvc1
2
3
4
5
6
7
8
9
10
11 volumeMounts:
- name: elasticsearch-logging
mountPath: /data
env:
- name: "NAMESPACE"
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumes:
- name: elasticsearch-logging
emptyDir: {}
简单的 mysql 示例
1 | --- |