Skip to content

Instantly share code, notes, and snippets.

@thebsdbox
Created December 8, 2020 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebsdbox/c86dd970549638105af8d96439175a59 to your computer and use it in GitHub Desktop.
Save thebsdbox/c86dd970549638105af8d96439175a59 to your computer and use it in GitHub Desktop.
ccm.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: packet-cloud-controller-manager
namespace: kube-system
labels:
app: packet-cloud-controller-manager
spec:
replicas: 1
selector:
matchLabels:
app: packet-cloud-controller-manager
template:
metadata:
labels:
app: packet-cloud-controller-manager
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
dnsPolicy: Default
hostNetwork: true
serviceAccountName: cloud-controller-manager
tolerations:
# this taint is set by all kubelets running `--cloud-provider=external`
# so we should tolerate it to schedule the packet ccm
- key: "node.cloudprovider.kubernetes.io/uninitialized"
value: "true"
effect: "NoSchedule"
- key: "CriticalAddonsOnly"
operator: "Exists"
# cloud controller manager should be able to run on masters
- key: "node-role.kubernetes.io/master"
effect: NoSchedule
containers:
- image: thebsdbox/packet-ccm:hack
name: packet-cloud-controller-manager
command:
- "./packet-cloud-controller-manager"
- "--cloud-provider=packet"
- "--leader-elect=false"
- "--allow-untagged-cloud=true"
- "--authentication-skip-lookup=true"
- "--provider-config=/etc/cloud-sa/cloud-sa.json"
env:
- name: PACKET_LB_CONFIGMAP
value: "disabled"
resources:
requests:
cpu: 100m
memory: 50Mi
volumeMounts:
- name: cloud-sa-volume
readOnly: true
mountPath: "/etc/cloud-sa"
volumes:
- name: cloud-sa-volume
secret:
secretName: packet-cloud-config
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cloud-controller-manager
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
name: system:cloud-controller-manager
rules:
- apiGroups:
# reason: so ccm can monitor and update endpoints, used for control plane loadbalancer
- ""
resources:
- endpoints
verbs:
- create
- get
- list
- watch
- update
- apiGroups:
# reason: so ccm can read and update nodes and annotations
- ""
resources:
- nodes
verbs:
- '*'
- apiGroups:
# reason: so ccm can update the status of nodes
- ""
resources:
- nodes/status
verbs:
- patch
- apiGroups:
# reason: so ccm can manage services for loadbalancer
- ""
resources:
- services
verbs:
- get
- list
- patch
- update
- watch
- create
- apiGroups:
# reason: so ccm can update the status of services for loadbalancer
- ""
resources:
- services/status
verbs:
- list
- patch
- update
- watch
- apiGroups:
# reason: so ccm can read and update configmap/metallb-system:config
- ""
resources:
- configmaps
verbs:
- create
- get
- list
- watch
- update
- patch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: system:cloud-controller-manager
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:cloud-controller-manager
subjects:
- kind: ServiceAccount
name: cloud-controller-manager
namespace: kube-system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment