scope 是 weave公司开源的用于监控,可视化,管理kubernetes集群的一个相似于dashbord的UI系统。有一下四大特色:node
我的感受有两个地方作的不错。第一个是scope提供了容器之间的业务拓扑,能够很方便的查看调用关系。
另一个是scope-traffic-control插件,该插件用来控制容器的流量。
自己k8s只提供了cpu,内存和存储的限制。在官方不支持流控以前,也是一个不侵入的选择。利用的原理就是linux tc。后期咱们会对该插件专门介绍。linux
直接上yaml文件git
apiVersion: v1 kind: List items: - apiVersion: v1 kind: Namespace metadata: name: weave annotations: cloud.weave.works/version: v1.0.0-44-gd0d2369 - apiVersion: v1 kind: ServiceAccount metadata: name: weave-scope annotations: cloud.weave.works/launcher-info: |- { "original-request": { "url": "/k8s/scope.yaml?k8s-version=1.8.0", "date": "Sat Feb 24 2018 09:12:44 GMT+0000 (UTC)" }, "email-address": "support@weave.works" } labels: name: weave-scope namespace: weave - apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole metadata: name: weave-scope annotations: cloud.weave.works/launcher-info: |- { "original-request": { "url": "/k8s/scope.yaml?k8s-version=1.8.0", "date": "Sat Feb 24 2018 09:12:44 GMT+0000 (UTC)" }, "email-address": "support@weave.works" } labels: name: weave-scope namespace: weave rules: - apiGroups: - '*' resources: - '*' verbs: - '*' - nonResourceURLs: - '*' verbs: - '*' - apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: weave-scope annotations: cloud.weave.works/launcher-info: |- { "original-request": { "url": "/k8s/scope.yaml?k8s-version=1.8.0", "date": "Sat Feb 24 2018 09:12:44 GMT+0000 (UTC)" }, "email-address": "support@weave.works" } labels: name: weave-scope namespace: weave roleRef: kind: ClusterRole name: weave-scope apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount name: weave-scope namespace: weave - apiVersion: apps/v1beta1 kind: Deployment metadata: name: weave-scope-app annotations: cloud.weave.works/launcher-info: |- { "original-request": { "url": "/k8s/scope.yaml?k8s-version=1.8.0", "date": "Sat Feb 24 2018 09:12:44 GMT+0000 (UTC)" }, "email-address": "support@weave.works" } labels: name: weave-scope-app app: weave-scope weave-cloud-component: scope weave-scope-component: app namespace: weave spec: replicas: 1 revisionHistoryLimit: 2 template: metadata: labels: name: weave-scope-app app: weave-scope weave-cloud-component: scope weave-scope-component: app spec: containers: - name: app args: - '--no-probe' - '--weave=false' env: [] image: 'registry.xxx.com/kubernetes/scope:1.7.3' imagePullPolicy: IfNotPresent ports: - containerPort: 4040 protocol: TCP - apiVersion: v1 kind: Service metadata: name: weave-scope-app annotations: cloud.weave.works/launcher-info: |- { "original-request": { "url": "/k8s/scope.yaml?k8s-version=1.8.0", "date": "Sat Feb 24 2018 09:12:44 GMT+0000 (UTC)" }, "email-address": "support@weave.works" } labels: name: weave-scope-app app: weave-scope weave-cloud-component: scope weave-scope-component: app namespace: weave spec: type: NodePort ports: - name: app port: 80 protocol: TCP targetPort: 4040 nodePort: 32404 selector: name: weave-scope-app app: weave-scope weave-cloud-component: scope weave-scope-component: app - apiVersion: extensions/v1beta1 kind: DaemonSet metadata: name: weave-scope-agent annotations: cloud.weave.works/launcher-info: |- { "original-request": { "url": "/k8s/scope.yaml?k8s-version=1.8.0", "date": "Sat Feb 24 2018 09:12:44 GMT+0000 (UTC)" }, "email-address": "support@weave.works" } labels: name: weave-scope-agent app: weave-scope weave-cloud-component: scope weave-scope-component: agent namespace: weave spec: template: metadata: labels: name: weave-scope-agent app: weave-scope weave-cloud-component: scope weave-scope-component: agent spec: containers: - name: scope-agent args: - '--no-app' - '--probe.docker.bridge=docker0' - '--probe.docker=true' - '--probe.kubernetes=true' - 'weave-scope-app.weave:80' - '--weave=false' env: - name: KUBERNETES_HOSTNAME valueFrom: fieldRef: apiVersion: v1 fieldPath: spec.nodeName image: 'registry.xxx.com/kubernetes/scope:1.7.3' imagePullPolicy: IfNotPresent securityContext: privileged: true volumeMounts: - name: docker-socket mountPath: /var/run/docker.sock - name: scope-plugins mountPath: /var/run/scope/plugins - name: sys-kernel-debug mountPath: /sys/kernel/debug dnsPolicy: ClusterFirstWithHostNet hostNetwork: true hostPID: true serviceAccountName: weave-scope tolerations: - effect: NoSchedule operator: Exists volumes: - name: docker-socket hostPath: path: /var/run/docker.sock - name: scope-plugins hostPath: path: /var/run/scope/plugins - name: sys-kernel-debug hostPath: path: /sys/kernel/debug updateStrategy: type: RollingUpdate
curl https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.6.7 -sL -o scope.yaml
最后上一张效果图github
固然若是是一个商用的k8s集群,scope远远不够。可是对于内部使用,scope是dashbord的一种很好的补充,也能够扩展,来知足本身。web