1.helm安装
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh
helm init --history-max 200
helm repo update
helm install stable/mysql
helm ls
kubectl -n kube-system create serviceaccount tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --upgrade
helm ls
kubectl --namespace kube-system patch deploy tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm list
helm repo update
2.安装ingress
helm install stable/nginx-ingress --name my-release --set controller.stats.enabled=true,controller.kind=DaemonSet,controller.daemonset.useHostPort=true,controller.publishService.enabled=true,controller.service.externalTrafficPolicy=Local,controller.service.type=NodePort,controller.stats.enabled=true,controller.metrics.enabled=true helm安装最好用value文件更新要不然会抵消上一个版本的值。
3.安装prometheus operator
helm install stable/prometheus-operator
4.配置servicemonitors.monitoring.coreos.com
[root@iZrj969udf3fibvyz4dlieZ ~]# kubectl get servicemonitors.monitoring.coreos.com nginx-ingress-controller-metrics -oyaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
creationTimestamp: "2019-04-16T06:28:05Z"
generation: 3
labels:
app: nginx-ingress
release: my-prome
name: nginx-ingress-controller-metrics
namespace: default
resourceVersion: "251985"
selfLink: /apis/monitoring.coreos.com/v1/namespaces/default/servicemonitors/nginx-ingress-controller-metrics
uid: cb394d30-6010-11e9-b794-00163e004c35
spec:
endpoints:
- interval: 30s
port: metrics
namespaceSelector:
matchNames:
- default
selector:
matchLabels:
app: nginx-ingress
release: my-release
5.uI界面