Connecting a CCE Cluster to Heapster for Monitoring
Prerequisites
The dashboard add-on has been installed and connected to the cluster using kubectl.
Procedure
- Create influxdb.yaml, heapster.yaml, and heapster-rbac.yaml resource files.
- Create an influxdb.yaml file.
vi influxdb.yaml
kubectl create -f influxdb.yaml
Modify the image path in the influxdb.yaml file. Official images are supported. You can also download the influxdb.yaml file from https://github.com/kubernetes-retired/heapster/blob/master/deploy/kube-config/influxdb/influxdb.yaml.
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: monitoring-influxdb namespace: kube-system spec: replicas: 1 template: metadata: labels: task: monitoring k8s-app: influxdb spec: containers: - name: influxdb image: k8s.gcr.io/heapster-influxdb-amd64:v1.5.2 volumeMounts: - mountPath: /data name: influxdb-storage volumes: - name: influxdb-storage emptyDir: {} --- apiVersion: v1 kind: Service metadata: labels: task: monitoring # For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons) # If you are NOT using this as an addon, you should comment out this line. kubernetes.io/cluster-service: 'true' kubernetes.io/name: monitoring-influxdb name: monitoring-influxdb namespace: kube-system spec: ports: - port: 8086 targetPort: 8086 selector: k8s-app: influxdb - Create a heapster.yaml file.
vi heapster.yaml
kubectl create -f heapster.yaml
Modify the image path in the heapster.yaml file. Official images are supported. You can also download the heapster.yaml file from https://github.com/kubernetes-retired/heapster/blob/master/deploy/kube-config/standalone/heapster-controller.yaml.apiVersion: v1 kind: ServiceAccount metadata: name: heapster namespace: kube-system --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: heapster namespace: kube-system spec: replicas: 1 template: metadata: labels: task: monitoring k8s-app: heapster spec: serviceAccountName: heapster containers: - name: heapster image: k8s.gcr.io/heapster-amd64:v1.5.4 imagePullPolicy: IfNotPresent command: - /heapster - --source=kubernetes:https://kubernetes.default - --sink=influxdb:http://monitoring-influxdb.kube-system.svc:8086 --- apiVersion: v1 kind: Service metadata: labels: task: monitoring # For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons) # If you are NOT using this as an addon, you should comment out this line. kubernetes.io/cluster-service: 'true' kubernetes.io/name: Heapster name: heapster namespace: kube-system spec: ports: - port: 80 targetPort: 8082 selector: k8s-app: heapster - Create a heapster.yaml file.
vi heapster.yaml
kubectl create -f heapster.yaml
You can also download the heapster.yaml file from https://github.com/kubernetes-retired/heapster/blob/master/deploy/kube-config/influxdb/heapster.yaml.kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: name: heapster roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: system:heapster subjects: - kind: ServiceAccount name: heapster namespace: kube-system
- Create an influxdb.yaml file.
- Add the heapster permission to the ClusterRole resource of the dashboard.
kubectl edit ClusterRole role-dashboard
Add the following information to the end of the rule field:# heapster related access - apiGroups: [""] resources: ["services"] resourceNames: ["heapster"] verbs: ["proxy"] - apiGroups: [""] resources: ["services/proxy"] resourceNames: ["heapster", "http:heapster:", "https:heapster:"] verbs: ["get"]
After the information is added, information similar to the following is displayed:

- Add startup parameters to the deploy resource of the dashboard.
kubectl edit deploy kubernetes-dashboard -n kube-system
Add the following information to the end of the spec.spec.containers field:args: - --heapster-host=http://heapster.kube-system
After the information is added, information similar to the following is displayed:

- Access kubernetes-dashboard at https://EIP:Port.
Last Article: Monitoring
Next Article: Auto Scaling
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.