kubeasz/roles/kube-ovn/templates/ovn.yaml.j2

405 lines
9.3 KiB
Plaintext
Raw Normal View History

2021-01-18 10:21:48 +08:00
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
2019-05-22 11:17:42 +08:00
metadata:
name: kube-ovn
2021-01-18 10:21:48 +08:00
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
spec:
privileged: true
allowPrivilegeEscalation: true
allowedCapabilities:
- '*'
volumes:
- '*'
hostNetwork: true
hostPorts:
- min: 0
max: 65535
hostIPC: true
hostPID: true
runAsUser:
rule: 'RunAsAny'
seLinux:
rule: 'RunAsAny'
supplementalGroups:
rule: 'RunAsAny'
fsGroup:
rule: 'RunAsAny'
2019-05-22 11:17:42 +08:00
---
2021-01-18 10:21:48 +08:00
2019-05-22 11:17:42 +08:00
apiVersion: v1
kind: ConfigMap
metadata:
name: ovn-config
2021-01-18 10:21:48 +08:00
namespace: kube-system
2019-05-22 11:17:42 +08:00
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: ovn
2021-01-18 10:21:48 +08:00
namespace: kube-system
2019-05-22 11:17:42 +08:00
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.k8s.io/system-only: "true"
2019-07-23 13:28:46 +08:00
name: system:ovn
2019-05-22 11:17:42 +08:00
rules:
2021-01-18 10:21:48 +08:00
- apiGroups: ['policy']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames:
- kube-ovn
2019-07-23 13:28:46 +08:00
- apiGroups:
- "kubeovn.io"
resources:
- subnets
2019-10-14 18:21:30 +08:00
- subnets/status
2019-07-23 13:28:46 +08:00
- ips
2021-01-18 10:21:48 +08:00
- vlans
- networks
2019-07-23 13:28:46 +08:00
verbs:
- "*"
2019-05-22 11:17:42 +08:00
- apiGroups:
- ""
resources:
- pods
- namespaces
- nodes
2019-07-23 13:28:46 +08:00
- configmaps
2019-05-22 11:17:42 +08:00
verbs:
2019-07-23 13:28:46 +08:00
- create
2019-05-22 11:17:42 +08:00
- get
- list
- watch
2019-07-23 13:28:46 +08:00
- patch
- update
2019-05-22 11:17:42 +08:00
- apiGroups:
2019-07-23 13:28:46 +08:00
- ""
2019-05-22 11:17:42 +08:00
- networking.k8s.io
2019-10-14 18:21:30 +08:00
- apps
2021-01-18 10:21:48 +08:00
- extensions
2019-05-22 11:17:42 +08:00
resources:
- networkpolicies
2019-07-23 13:28:46 +08:00
- services
- endpoints
2019-10-14 18:21:30 +08:00
- statefulsets
- daemonsets
2021-01-18 10:21:48 +08:00
- deployments
2019-05-22 11:17:42 +08:00
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
2019-07-23 13:28:46 +08:00
name: ovn
2019-05-22 11:17:42 +08:00
roleRef:
2019-07-23 13:28:46 +08:00
name: system:ovn
2019-05-22 11:17:42 +08:00
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: ovn
2021-01-18 10:21:48 +08:00
namespace: kube-system
2019-05-22 11:17:42 +08:00
---
kind: Service
apiVersion: v1
metadata:
name: ovn-nb
2021-01-18 10:21:48 +08:00
namespace: kube-system
2019-05-22 11:17:42 +08:00
spec:
ports:
- name: ovn-nb
protocol: TCP
port: 6641
targetPort: 6641
type: ClusterIP
selector:
app: ovn-central
2021-01-18 10:21:48 +08:00
ovn-nb-leader: "true"
2019-05-22 11:17:42 +08:00
sessionAffinity: None
---
kind: Service
apiVersion: v1
metadata:
name: ovn-sb
2021-01-18 10:21:48 +08:00
namespace: kube-system
2019-05-22 11:17:42 +08:00
spec:
ports:
- name: ovn-sb
protocol: TCP
port: 6642
targetPort: 6642
type: ClusterIP
selector:
app: ovn-central
2021-01-18 10:21:48 +08:00
ovn-sb-leader: "true"
2019-05-22 11:17:42 +08:00
sessionAffinity: None
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: ovn-central
2021-01-18 10:21:48 +08:00
namespace: kube-system
2019-05-22 11:17:42 +08:00
annotations:
kubernetes.io/description: |
OVN components: northd, nb and sb.
spec:
replicas: 1
strategy:
rollingUpdate:
maxSurge: 0%
maxUnavailable: 100%
type: RollingUpdate
selector:
matchLabels:
app: ovn-central
template:
metadata:
labels:
app: ovn-central
component: network
type: infra
spec:
tolerations:
2021-01-18 10:21:48 +08:00
- operator: Exists
2019-05-22 11:17:42 +08:00
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: ovn-central
topologyKey: kubernetes.io/hostname
2021-01-18 10:21:48 +08:00
priorityClassName: system-cluster-critical
2019-05-22 11:17:42 +08:00
serviceAccountName: ovn
hostNetwork: true
containers:
- name: ovn-central
2021-01-18 10:21:48 +08:00
image: "kubeovn/kube-ovn:v1.5.3"
2019-05-22 11:17:42 +08:00
imagePullPolicy: IfNotPresent
2021-01-18 10:21:48 +08:00
command: ["/kube-ovn/start-db.sh"]
securityContext:
capabilities:
add: ["SYS_NICE"]
2019-05-22 11:17:42 +08:00
env:
2021-01-18 10:21:48 +08:00
- name: ENABLE_SSL
value: "false"
2019-05-22 11:17:42 +08:00
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
2021-01-18 10:21:48 +08:00
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
2019-05-22 11:17:42 +08:00
resources:
requests:
2021-01-18 10:21:48 +08:00
cpu: 500m
memory: 200Mi
2019-05-22 11:17:42 +08:00
limits:
2021-01-18 10:21:48 +08:00
cpu: 3
memory: 3Gi
2019-05-22 11:17:42 +08:00
volumeMounts:
- mountPath: /var/run/openvswitch
name: host-run-ovs
2021-01-18 10:21:48 +08:00
- mountPath: /var/run/ovn
name: host-run-ovn
2019-05-22 11:17:42 +08:00
- mountPath: /sys
name: host-sys
readOnly: true
- mountPath: /etc/openvswitch
name: host-config-openvswitch
2021-01-18 10:21:48 +08:00
- mountPath: /etc/ovn
name: host-config-ovn
2019-05-22 11:17:42 +08:00
- mountPath: /var/log/openvswitch
2021-01-18 10:21:48 +08:00
name: host-log-ovs
- mountPath: /var/log/ovn
name: host-log-ovn
- mountPath: /var/run/tls
name: kube-ovn-tls
2019-05-22 11:17:42 +08:00
readinessProbe:
exec:
command:
- sh
2021-01-18 10:21:48 +08:00
- /kube-ovn/ovn-is-leader.sh
2019-05-22 11:17:42 +08:00
periodSeconds: 3
2021-01-18 10:21:48 +08:00
timeoutSeconds: 45
2019-05-22 11:17:42 +08:00
livenessProbe:
exec:
command:
2021-01-18 10:21:48 +08:00
- sh
- /kube-ovn/ovn-healthcheck.sh
2019-05-22 11:17:42 +08:00
initialDelaySeconds: 30
periodSeconds: 7
failureThreshold: 5
2021-01-18 10:21:48 +08:00
timeoutSeconds: 45
2019-05-22 11:17:42 +08:00
nodeSelector:
2021-01-18 10:21:48 +08:00
kubernetes.io/os: "linux"
2019-05-22 11:17:42 +08:00
kube-ovn/role: "master"
volumes:
- name: host-run-ovs
hostPath:
path: /run/openvswitch
2021-01-18 10:21:48 +08:00
- name: host-run-ovn
hostPath:
path: /run/ovn
2019-05-22 11:17:42 +08:00
- name: host-sys
hostPath:
path: /sys
- name: host-config-openvswitch
hostPath:
path: /etc/origin/openvswitch
2021-01-18 10:21:48 +08:00
- name: host-config-ovn
hostPath:
path: /etc/origin/ovn
- name: host-log-ovs
2019-05-22 11:17:42 +08:00
hostPath:
path: /var/log/openvswitch
2021-01-18 10:21:48 +08:00
- name: host-log-ovn
hostPath:
path: /var/log/ovn
- name: kube-ovn-tls
secret:
optional: true
secretName: kube-ovn-tls
2019-05-22 11:17:42 +08:00
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: ovs-ovn
2021-01-18 10:21:48 +08:00
namespace: kube-system
2019-05-22 11:17:42 +08:00
annotations:
kubernetes.io/description: |
This daemon set launches the openvswitch daemon.
spec:
selector:
matchLabels:
app: ovs
updateStrategy:
2019-11-27 11:18:45 +08:00
type: OnDelete
2019-05-22 11:17:42 +08:00
template:
metadata:
labels:
app: ovs
component: network
type: infra
spec:
tolerations:
2021-01-18 10:21:48 +08:00
- operator: Exists
priorityClassName: system-cluster-critical
2019-05-22 11:17:42 +08:00
serviceAccountName: ovn
hostNetwork: true
hostPID: true
containers:
- name: openvswitch
2021-01-18 10:21:48 +08:00
image: "kubeovn/kube-ovn:v1.5.3"
2019-05-22 11:17:42 +08:00
imagePullPolicy: IfNotPresent
2021-01-18 10:21:48 +08:00
command: ["/kube-ovn/start-ovs.sh"]
2019-05-22 11:17:42 +08:00
securityContext:
runAsUser: 0
privileged: true
env:
2021-01-18 10:21:48 +08:00
- name: ENABLE_SSL
value: "false"
2019-05-22 11:17:42 +08:00
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
2021-01-18 10:21:48 +08:00
- name: HW_OFFLOAD
value: "false"
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
2019-05-22 11:17:42 +08:00
volumeMounts:
- mountPath: /lib/modules
name: host-modules
readOnly: true
- mountPath: /var/run/openvswitch
name: host-run-ovs
2021-01-18 10:21:48 +08:00
- mountPath: /var/run/ovn
name: host-run-ovn
2019-05-22 11:17:42 +08:00
- mountPath: /sys
name: host-sys
readOnly: true
- mountPath: /etc/openvswitch
name: host-config-openvswitch
2021-01-18 10:21:48 +08:00
- mountPath: /etc/ovn
name: host-config-ovn
2019-05-22 11:17:42 +08:00
- mountPath: /var/log/openvswitch
2021-01-18 10:21:48 +08:00
name: host-log-ovs
- mountPath: /var/log/ovn
name: host-log-ovn
- mountPath: /var/run/tls
name: kube-ovn-tls
2019-05-22 11:17:42 +08:00
readinessProbe:
exec:
command:
2021-01-18 10:21:48 +08:00
- sh
- /kube-ovn/ovs-healthcheck.sh
2019-05-22 11:17:42 +08:00
periodSeconds: 5
2021-01-18 10:21:48 +08:00
timeoutSeconds: 45
2019-05-22 11:17:42 +08:00
livenessProbe:
exec:
command:
2021-01-18 10:21:48 +08:00
- sh
- /kube-ovn/ovs-healthcheck.sh
2019-05-22 11:17:42 +08:00
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 5
2021-01-18 10:21:48 +08:00
timeoutSeconds: 45
2019-05-22 11:17:42 +08:00
resources:
requests:
2019-11-27 11:18:45 +08:00
cpu: 200m
2021-01-18 10:21:48 +08:00
memory: 200Mi
2019-05-22 11:17:42 +08:00
limits:
2019-11-27 11:18:45 +08:00
cpu: 1000m
memory: 800Mi
2019-05-22 11:17:42 +08:00
nodeSelector:
2021-01-18 10:21:48 +08:00
kubernetes.io/os: "linux"
2019-05-22 11:17:42 +08:00
volumes:
- name: host-modules
hostPath:
path: /lib/modules
- name: host-run-ovs
hostPath:
path: /run/openvswitch
2021-01-18 10:21:48 +08:00
- name: host-run-ovn
hostPath:
path: /run/ovn
2019-05-22 11:17:42 +08:00
- name: host-sys
hostPath:
path: /sys
- name: host-config-openvswitch
hostPath:
path: /etc/origin/openvswitch
2021-01-18 10:21:48 +08:00
- name: host-config-ovn
hostPath:
path: /etc/origin/ovn
- name: host-log-ovs
2019-05-22 11:17:42 +08:00
hostPath:
path: /var/log/openvswitch
2021-01-18 10:21:48 +08:00
- name: host-log-ovn
hostPath:
path: /var/log/ovn
- name: kube-ovn-tls
secret:
optional: true
secretName: kube-ovn-tls