Kubernetes扩展插件 Cluster Monitoring安装

Kubernetes扩展插件 Cluster Monitoring安装

 

cd ~/kubernetes/cluster/addons/cluster-monitoring/influxdb

mkdir -p ~/workspace/influxdb

cp * ~/workspace/influxdb/

cd ~/workspace/influxdb

ls -l

 

-----------------------------------------------------------------------------------------------------------------  

vi influxdb-grafana-controller.yaml

将端口映射到宿主机

 ports: 

   - containerPort: 8083

     hostPort: 8083

   - containerPort: 8086

     hostPort: 8086

 

修改heapster_influxdb:v0.4

heapster_grafana:v2.1.1

 

sed -i "s/heapster_influxdb:v0.5/heapster_influxdb:v0.4/" influxdb-grafana-controller.yaml

sed -i "s/heapster_grafana:v2.6.0-2/heapster_grafana:v2.1.1/" influxdb-grafana-controller.yaml

 

注释掉环境变量(仅保留第一个)

env:

   # This variable is required to setup templates in Grafana.

   - name: INFLUXDB_SERVICE_URL

     value: http://monitoring-influxdb:8086

     # The following env variables are required to make Grafana accessible via

     # the kubernetes api-server proxy. On production clusters, we recommend

     # removing these env variables, setup auth for grafana, and expose the grafana

     # service using a LoadBalancer or a public IP.

     # - name: GF_AUTH_BASIC_ENABLED

     #  value: "false"

     # - name: GF_AUTH_ANONYMOUS_ENABLED

     #  value: "true"

     # - name: GF_AUTH_ANONYMOUS_ORG_ROLE

     #  value: Admin

     # - name: GF_SERVER_ROOT_URL

     #  value: /api/v1/proxy/namespaces/kube-system/services/monitoring-grafana/

     

     kubectl create -f influxdb-grafana-controller.yaml

     replicationcontroller "monitoring-influxdb-grafana-v3" created

     

     kubectl get pod --selector k8s-app=influxGrafana --namespace=kube-system --output wide

     NAME                                   READY     STATUS    RESTARTS   AGE       IP            NODE

monitoring-influxdb-grafana-v3-306al   2/2       Running   0          2m        172.16.37.6   vultr.guest-12

 

 

使用浏览器访问influxdb

http://vultr.guest-12的外网IP:8083

-------------------------------------- 

创建service

kubectl create -f influxdb-service.yaml

 

 

修改grafana-service.yaml中spec.type

type: NodePort

 

kubectl create -f grafana-service.yaml

 

You have exposed your service on an external port on all nodes in your

cluster.  If you want to expose this service to the external internet, you may

need to set up firewall rules for the service port(s) (tcp:32392) to serve traffic.

 

See http://releases.k8s.io/release-1.3/docs/user-guide/services-firewalls.md for more details.

service "monitoring-grafana" created

 

根据返回的端口 port(s) (tcp:32392)

使用浏览器访问该地址:http://节点IP:32392

打开grafana界面

--------------------------------------

 

修改heapster-controller.yaml文件

 

cat <<EOF >heapster-controller.yaml

 

apiVersion: v1

kind: ReplicationController

metadata:

  name: heapster-v10

  namespace: kube-system

  labels:

    k8s-app: heapster

    kubernetes.io/cluster-service: "true"

    version: v10

spec:

  replicas: 1

  selector:

    k8s-app: heapster

    version: v10

  template:

    metadata:

      labels:

        k8s-app: heapster

        version: v10

    spec:

      containers:

        - image: gcr.io/google_containers/heapster:v0.18.2

          name: heapster

          resources:

            # keep request = limit to keep this container in guaranteed class

            limits:

              cpu: 100m

              memory: 300Mi

          command:

            - /heapster

            - --source=kubernetes:http://10.99.0.10:8080?inClusterConfig=false&userServiceAccount=false

            - --sink=influxdb:http://monitoring-influxdb:8086

            - --stats_resolution=30s

            - --sink_frequency=1m

EOF

--------------------

kubectl create -f heapster-controller.yaml

 

kubectl get pod --selector k8s-app=heapster --namespace=kube-system --output wide

---------------

kubectl create -f heapster-service.yaml

 

然后再查看grafana界面

 

     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值