Skip to content

Instantly share code, notes, and snippets.

@cmer81
Created August 14, 2018 23:49
Show Gist options
  • Save cmer81/cccf6ef6ad4f26c889a146de74ffa777 to your computer and use it in GitHub Desktop.
Save cmer81/cccf6ef6ad4f26c889a146de74ffa777 to your computer and use it in GitHub Desktop.
Traefik DaemonSet with ServiceAccount and ClusterRole
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
namespace: ingress
---
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: traefik-ingress-controller
namespace: ingress
labels:
k8s-app: traefik-ingress-lb
spec:
template:
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: traefik
operator: In
values:
- "true"
containers:
- image: traefik
name: traefik-ingress-lb
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 80
timeoutSeconds: 2
ports:
- containerPort: 80
hostPort: 80
name: http
protocol: TCP
- containerPort: 8080
hostPort: 8080
name: admin
protocol: TCP
- containerPort: 443
hostPort: 443
name: 443tcp4430
protocol: TCP
readinessProbe:
failureThreshold: 1
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 80
timeoutSeconds: 2
resources:
limits:
memory: 256Mi
requests:
cpu: 100m
memory: 20Mi
securityContext:
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE
args:
- --configfile=/config/traefik.toml
volumeMounts:
- mountPath: /config
name: config
volumes:
- configMap:
defaultMode: 256
name: traefik
optional: false
name: config
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: traefik-ingress
serviceAccount: traefik-ingress-controller
serviceAccountName: traefik-ingress-controller
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ingress
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- get
- list
- watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ingress
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ingress
subjects:
- kind: ServiceAccount
name: ingress
namespace: ingress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment