266 lines
6.3 KiB
YAML
266 lines
6.3 KiB
YAML
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: calico-kube-controllers
|
|
namespace: kube-system
|
|
---
|
|
# Include a clusterrole for the kube-controllers component,
|
|
# and bind it to the calico-kube-controllers serviceaccount.
|
|
kind: ClusterRole
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: calico-kube-controllers
|
|
rules:
|
|
# Pods are monitored for changing labels.
|
|
# The node controller monitors Kubernetes nodes.
|
|
# Namespace and serviceaccount labels are used for policy.
|
|
- apiGroups:
|
|
- ""
|
|
- extensions
|
|
resources:
|
|
- pods
|
|
- nodes
|
|
- namespaces
|
|
- serviceaccounts
|
|
- networkpolicies
|
|
verbs:
|
|
- watch
|
|
- list
|
|
- apiGroups:
|
|
- networking.k8s.io
|
|
resources:
|
|
- networkpolicies
|
|
verbs:
|
|
- watch
|
|
- list
|
|
---
|
|
kind: ClusterRoleBinding
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: calico-kube-controllers
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: calico-kube-controllers
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: calico-kube-controllers
|
|
namespace: kube-system
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: calico-kube-controllers
|
|
namespace: kube-system
|
|
labels:
|
|
k8s-app: calico-kube-controllers
|
|
cdk-restart-on-ca-change: "true"
|
|
spec:
|
|
# Only a single instance of the this pod should be
|
|
# active at a time. Since this pod is run as a Deployment,
|
|
# Kubernetes will ensure the pod is recreated in case of failure,
|
|
# removing the need for passive backups.
|
|
selector:
|
|
matchLabels:
|
|
k8s-app: calico-kube-controllers
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
template:
|
|
metadata:
|
|
name: calico-kube-controllers
|
|
namespace: kube-system
|
|
labels:
|
|
k8s-app: calico-kube-controllers
|
|
annotations:
|
|
# annotate etcd cert modification time, so that when it changes, k8s
|
|
# will restart the pod
|
|
cdk-etcd-cert-last-modified: "{{ etcd_cert_last_modified }}"
|
|
spec:
|
|
hostNetwork: true
|
|
serviceAccountName: calico-kube-controllers
|
|
containers:
|
|
- name: calico-kube-controllers
|
|
image: {{ calico_policy_image }}
|
|
env:
|
|
- name: ETCD_ENDPOINTS
|
|
value: {{ connection_string }}
|
|
- name: ETCD_CA_CERT_FILE
|
|
value: {{ etcd_ca_path }}
|
|
- name: ETCD_CERT_FILE
|
|
value: {{ etcd_cert_path }}
|
|
- name: ETCD_KEY_FILE
|
|
value: {{ etcd_key_path }}
|
|
volumeMounts:
|
|
- name: calicoctl
|
|
mountPath: /opt/calicoctl
|
|
volumes:
|
|
- name: calicoctl
|
|
hostPath:
|
|
path: /opt/calicoctl
|
|
---
|
|
kind: ClusterRole
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: calico-node
|
|
rules:
|
|
# The CNI plugin needs to get pods, nodes, and namespaces.
|
|
- apiGroups: [""]
|
|
resources:
|
|
- pods
|
|
- nodes
|
|
- namespaces
|
|
verbs:
|
|
- get
|
|
- apiGroups: [""]
|
|
resources:
|
|
- endpoints
|
|
- services
|
|
verbs:
|
|
# Used to discover service IPs for advertisement.
|
|
- watch
|
|
- list
|
|
# Used to discover Typhas.
|
|
- get
|
|
- apiGroups: [""]
|
|
resources:
|
|
- nodes/status
|
|
verbs:
|
|
# Needed for clearing NodeNetworkUnavailable flag.
|
|
- patch
|
|
# Calico stores some configuration information in node annotations.
|
|
- update
|
|
# Watch for changes to Kubernetes NetworkPolicies.
|
|
- apiGroups: ["networking.k8s.io"]
|
|
resources:
|
|
- networkpolicies
|
|
verbs:
|
|
- watch
|
|
- list
|
|
# Used by Calico for policy information.
|
|
- apiGroups: [""]
|
|
resources:
|
|
- pods
|
|
- namespaces
|
|
- serviceaccounts
|
|
verbs:
|
|
- list
|
|
- watch
|
|
# The CNI plugin patches pods/status.
|
|
- apiGroups: [""]
|
|
resources:
|
|
- pods/status
|
|
verbs:
|
|
- patch
|
|
# Calico monitors various CRDs for config.
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
resources:
|
|
- globalfelixconfigs
|
|
- felixconfigurations
|
|
- bgppeers
|
|
- globalbgpconfigs
|
|
- bgpconfigurations
|
|
- ippools
|
|
- ipamblocks
|
|
- globalnetworkpolicies
|
|
- globalnetworksets
|
|
- networkpolicies
|
|
- networksets
|
|
- clusterinformations
|
|
- hostendpoints
|
|
- blockaffinities
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
# Calico must create and update some CRDs on startup.
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
resources:
|
|
- ippools
|
|
- felixconfigurations
|
|
- clusterinformations
|
|
verbs:
|
|
- create
|
|
- update
|
|
# Calico stores some configuration information on the node.
|
|
- apiGroups: [""]
|
|
resources:
|
|
- nodes
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
# These permissions are only requried for upgrade from v2.6, and can
|
|
# be removed after upgrade or on fresh installations.
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
resources:
|
|
- bgpconfigurations
|
|
- bgppeers
|
|
verbs:
|
|
- create
|
|
- update
|
|
# These permissions are required for Calico CNI to perform IPAM allocations.
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
resources:
|
|
- blockaffinities
|
|
- ipamblocks
|
|
- ipamhandles
|
|
verbs:
|
|
- get
|
|
- list
|
|
- create
|
|
- update
|
|
- delete
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
resources:
|
|
- ipamconfigs
|
|
verbs:
|
|
- get
|
|
# Block affinities must also be watchable by confd for route aggregation.
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
resources:
|
|
- blockaffinities
|
|
verbs:
|
|
- watch
|
|
# The Calico IPAM migration needs to get daemonsets. These permissions can be
|
|
# removed if not upgrading from an installation using host-local IPAM.
|
|
- apiGroups: ["apps"]
|
|
resources:
|
|
- daemonsets
|
|
verbs:
|
|
- get
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: calico-node
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: calico-node
|
|
subjects:
|
|
- kind: User
|
|
name: system:calico-node
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: namespace-reader
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["namespaces"]
|
|
verbs: ["get"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: nodes-namespace-reader
|
|
subjects:
|
|
- apiGroup: rbac.authorization.k8s.io
|
|
kind: Group
|
|
name: system:nodes
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: namespace-reader
|