Skip to content

Instantly share code, notes, and snippets.

@gmaliar
Created September 1, 2017 13:10
Show Gist options
  • Select an option

  • Save gmaliar/a9863094a596bddb95be0dde31fb1e5d to your computer and use it in GitHub Desktop.

Select an option

Save gmaliar/a9863094a596bddb95be0dde31fb1e5d to your computer and use it in GitHub Desktop.
cluster auto scaler and ingress controller with persistent nodes
# cluster-autoscaler-deployment.yml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: cluster-autoscaler
namespace: kube-system
labels:
app: cluster-autoscaler
spec:
replicas: 1
selector:
matchLabels:
app: cluster-autoscaler
template:
metadata:
labels:
app: cluster-autoscaler
spec:
serviceAccountName: cluster-autoscaler
containers:
- image: gcr.io/google_containers/cluster-autoscaler:v0.6.1
name: cluster-autoscaler
resources:
limits:
cpu: 100m
memory: 300Mi
requests:
cpu: 100m
memory: 300Mi
command:
- ./cluster-autoscaler
- --cloud-provider=aws
- --expander=random
- --nodes=1:1:nodes.production.persistent.us-east-1a.tailor-brands-k8s.com
- --nodes=1:1:nodes.production.persistent.us-east-1b.tailor-brands-k8s.com
- --nodes=1:1:nodes.production.persistent.us-east-1c.tailor-brands-k8s.com
- --nodes=1:100:nodes.production.tailor-brands-k8s.com
env:
- name: AWS_REGION
value: us-east-1
volumeMounts:
- name: ssl-certs
mountPath: /etc/ssl/certs/ca-certificates.crt
readOnly: true
imagePullPolicy: Always
volumes:
- name: ssl-certs
hostPath:
path: /etc/ssl/certs/ca-certificates.crt
nodeSelector:
node-role.kubernetes.io/master: ""
tolerations:
- key: "node-role.kubernetes.io/master"
effect: NoSchedule
# ingress-controller-deployment.yml
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: ingress-nginx
spec:
replicas: 1
template:
metadata:
labels:
app: ingress-nginx
spec:
terminationGracePeriodSeconds: 60
nodeSelector:
persistentNode: "true"
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- ingress-nginx
topologyKey: kubernetes.io/hostname
containers:
- image: gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.11
name: ingress-nginx
imagePullPolicy: Always
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/nginx-default-backend
- --configmap=$(POD_NAMESPACE)/nginx-conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment