`
crabdave
  • 浏览: 1295032 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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界面

 

     

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics