Kubernetes 部署 Weave-Scope

Kubernetes 部署 Weave-Scope

1、下载镜像

docker pull docker.io/weaveworks/scope:1.6.7

2、获取weave-scope的yaml文件

curl https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.6.7 -sL -o scope.yaml

参考自:https://www.weave.works/docs/scope/latest/installing/

* 完整yaml 文件如下:*

apiVersion: v1
kind: List
items:
  - apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: weave-scope
      annotations:
        cloud.weave.works/launcher-info: |-
          {
            "server-version": "master-41bec27",
            "original-request": {
              "url": "/k8s/v1.6/scope.yaml?k8s-version=1.6.7",
              "date": "Mon Dec 25 2017 03:12:51 GMT+0000 (UTC)"
            },
            "email-address": "[email protected]"
          }
      labels:
        name: weave-scope
  - apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: ClusterRole
    metadata:
      name: weave-scope
      annotations:
        cloud.weave.works/launcher-info: |-
          {
            "server-version": "master-41bec27",
            "original-request": {
              "url": "/k8s/v1.6/scope.yaml?k8s-version=1.6.7",
              "date": "Mon Dec 25 2017 03:12:51 GMT+0000 (UTC)"
            },
            "email-address": "[email protected]"
          }
      labels:
        name: weave-scope
    rules:
      - apiGroups:
          - '*'
        resources:
          - '*'
        verbs:
          - '*'
      - nonResourceURLs:
          - '*'
        verbs:
          - '*'
  - apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: ClusterRoleBinding
    metadata:
      name: weave-scope
      annotations:
        cloud.weave.works/launcher-info: |-
          {
            "server-version": "master-41bec27",
            "original-request": {
              "url": "/k8s/v1.6/scope.yaml?k8s-version=1.6.7",
              "date": "Mon Dec 25 2017 03:12:51 GMT+0000 (UTC)"
            },
            "email-address": "[email protected]"
          }
      labels:
        name: weave-scope
    roleRef:
      kind: ClusterRole
      name: weave-scope
      apiGroup: rbac.authorization.k8s.io
    subjects:
      - kind: ServiceAccount
        name: weave-scope
        namespace: kube-system
  - apiVersion: apps/v1beta1
    kind: Deployment
    metadata:
      name: weave-scope-app
      annotations:
        cloud.weave.works/launcher-info: |-
          {
            "server-version": "master-41bec27",
            "original-request": {
              "url": "/k8s/v1.6/scope.yaml?k8s-version=1.6.7",
              "date": "Mon Dec 25 2017 03:12:51 GMT+0000 (UTC)"
            },
            "email-address": "[email protected]"
          }
      labels:
        name: weave-scope-app
        app: weave-scope
        weave-cloud-component: scope
        weave-scope-component: app
    spec:
      replicas: 1
      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'
              image: 'weaveworks/scope:1.6.7'
              imagePullPolicy: IfNotPresent
              ports:
                - containerPort: 4040
                  protocol: TCP
  - apiVersion: v1
    kind: Service
    metadata:
      name: weave-scope-app
      annotations:
        cloud.weave.works/launcher-info: |-
          {
            "server-version": "master-41bec27",
            "original-request": {
              "url": "/k8s/v1.6/scope.yaml?k8s-version=1.6.7",
              "date": "Mon Dec 25 2017 03:12:51 GMT+0000 (UTC)"
            },
            "email-address": "[email protected]"
          }
      labels:
        name: weave-scope-app
        app: weave-scope
        weave-cloud-component: scope
        weave-scope-component: app
    spec:
      ports:
        - name: app
          port: 80
          protocol: TCP
          targetPort: 4040
      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: |-
          {
            "server-version": "master-41bec27",
            "original-request": {
              "url": "/k8s/v1.6/scope.yaml?k8s-version=1.6.7",
              "date": "Mon Dec 25 2017 03:12:51 GMT+0000 (UTC)"
            },
            "email-address": "[email protected]"
          }
      labels:
        name: weave-scope-agent
        app: weave-scope
        weave-cloud-component: scope
        weave-scope-component: agent
    spec:
      template:
        metadata:
          labels:
            name: weave-scope-agent
            app: weave-scope
            weave-cloud-component: scope
            weave-scope-component: agent
        spec:
          containers:
            - name: agent
              args:
                - '--no-app'
                - '--probe.docker.bridge=docker0'
                - '--probe.docker=true'
                - '--probe.kubernetes=true'
                - 'weave-scope-app:80'
              image: 'weaveworks/scope:1.6.7'
              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

4、部署Weave-Scope

kubectl apply --namespace kube-system -f scope.yaml

猜你喜欢

转载自blog.csdn.net/zhangxiangui40542/article/details/78892451