From 55c3f8006df7afedbbf693fb25e8b5db20655ce5 Mon Sep 17 00:00:00 2001 From: Lili Cosic Date: Fri, 20 Jul 2018 07:32:25 +0200 Subject: [PATCH] Add example for cri-o cri-o was used as an example as it is relatively easy to setup a cluster using that container runtime as compared to others. --- examples/cri/cluster-role-binding.yaml | 16 ++++++ examples/cri/cluster-role.yaml | 44 +++++++++++++++++ examples/cri/deploy.yaml | 32 ++++++++++++ examples/cri/ds.yaml | 67 ++++++++++++++++++++++++++ examples/cri/ns.yaml | 5 ++ examples/cri/sa.yaml | 8 +++ examples/cri/svc.yaml | 22 +++++++++ 7 files changed, 194 insertions(+) create mode 100644 examples/cri/cluster-role-binding.yaml create mode 100644 examples/cri/cluster-role.yaml create mode 100644 examples/cri/deploy.yaml create mode 100644 examples/cri/ds.yaml create mode 100644 examples/cri/ns.yaml create mode 100644 examples/cri/sa.yaml create mode 100644 examples/cri/svc.yaml diff --git a/examples/cri/cluster-role-binding.yaml b/examples/cri/cluster-role-binding.yaml new file mode 100644 index 000000000..1956491bc --- /dev/null +++ b/examples/cri/cluster-role-binding.yaml @@ -0,0 +1,16 @@ +# borrowed from https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.10.0 +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: weave-scope + 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 diff --git a/examples/cri/cluster-role.yaml b/examples/cri/cluster-role.yaml new file mode 100644 index 000000000..14315bf29 --- /dev/null +++ b/examples/cri/cluster-role.yaml @@ -0,0 +1,44 @@ +# borrowed from https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.10.0 +# with little modificatios to reduce permissions +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + name: weave-scope + name: weave-scope + namespace: weave +rules: +- apiGroups: + - "" + resources: + - pods + - replicationcontrollers + - services + - nodes + verbs: + - list + - watch +- apiGroups: + - apps + resources: + - statefulsets + verbs: + - list + - watch +- apiGroups: + - batch + resources: + - cronjobs + - jobs + verbs: + - list + - watch +- apiGroups: + - extensions + resources: + - daemonsets + - deployments + - replicasets + verbs: + - list + - watch diff --git a/examples/cri/deploy.yaml b/examples/cri/deploy.yaml new file mode 100644 index 000000000..bf9b3ce0a --- /dev/null +++ b/examples/cri/deploy.yaml @@ -0,0 +1,32 @@ +# borrowed from https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.10.0 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: weave-scope-app + 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' + env: [] + image: weaveworks/scope:1.9.0 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 4040 + protocol: TCP diff --git a/examples/cri/ds.yaml b/examples/cri/ds.yaml new file mode 100644 index 000000000..d9a5a815b --- /dev/null +++ b/examples/cri/ds.yaml @@ -0,0 +1,67 @@ +# borrowed from https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.10.0 +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: weave-scope-agent + labels: + name: weave-scope-agent + app: weave-scope + weave-cloud-component: scope + weave-scope-component: agent + namespace: weave +spec: + minReadySeconds: 5 + 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=false' + - '--probe.kubernetes=true' + - '--probe.cri=true' + - '--probe.cri.endpoint=unix:///var/run/crio/crio.sock' + - 'weave-scope-app.weave.svc.cluster.local:80' + env: + - name: KUBERNETES_NODENAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + image: weaveworks/scope:1.9.0 + imagePullPolicy: IfNotPresent + securityContext: + privileged: true + volumeMounts: + - name: crio-socket + mountPath: /var/run/crio/crio.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: cri-socket + hostPath: + path: /var/run/crio/crio.sock + - name: scope-plugins + hostPath: + path: /var/run/scope/plugins + - name: sys-kernel-debug + hostPath: + path: /sys/kernel/debug + updateStrategy: + rollingUpdate: + maxUnavailable: 1 diff --git a/examples/cri/ns.yaml b/examples/cri/ns.yaml new file mode 100644 index 000000000..ca8a615ce --- /dev/null +++ b/examples/cri/ns.yaml @@ -0,0 +1,5 @@ +# borrowed from https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.10.0 +apiVersion: v1 +kind: Namespace +metadata: + name: weave diff --git a/examples/cri/sa.yaml b/examples/cri/sa.yaml new file mode 100644 index 000000000..63c12e928 --- /dev/null +++ b/examples/cri/sa.yaml @@ -0,0 +1,8 @@ +# borrowed from https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.10.0 +apiVersion: v1 +kind: ServiceAccount +metadata: + name: weave-scope + labels: + name: weave-scope + namespace: weave diff --git a/examples/cri/svc.yaml b/examples/cri/svc.yaml new file mode 100644 index 000000000..f30fcf0e4 --- /dev/null +++ b/examples/cri/svc.yaml @@ -0,0 +1,22 @@ +# borrowed from https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.10.0 +apiVersion: v1 +kind: Service +metadata: + name: weave-scope-app + labels: + name: weave-scope-app + app: weave-scope + weave-cloud-component: scope + weave-scope-component: app + namespace: weave +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