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