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.
This commit is contained in:
Lili Cosic
2018-07-20 07:32:25 +02:00
parent e6d9bcc1cb
commit 55c3f8006d
7 changed files with 194 additions and 0 deletions

View File

@@ -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

View File

@@ -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

32
examples/cri/deploy.yaml Normal file
View File

@@ -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

67
examples/cri/ds.yaml Normal file
View File

@@ -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

5
examples/cri/ns.yaml Normal file
View File

@@ -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

8
examples/cri/sa.yaml Normal file
View File

@@ -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

22
examples/cri/svc.yaml Normal file
View File

@@ -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