Created
November 5, 2018 23:00
-
-
Save icicimov/780f6fa3a0fc1b016e360afc980c5ce6 to your computer and use it in GitHub Desktop.
Kubernetes cluster-autoscaler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
labels: | |
k8s-addon: cluster-autoscaler.addons.k8s.io | |
app: cluster-autoscaler | |
name: cluster-autoscaler | |
namespace: kube-system | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRole | |
metadata: | |
name: cluster-autoscaler | |
labels: | |
k8s-addon: cluster-autoscaler.addons.k8s.io | |
app: cluster-autoscaler | |
rules: | |
- apiGroups: | |
- "" | |
resources: | |
- events | |
- endpoints | |
verbs: | |
- create | |
- patch | |
- apiGroups: | |
- "" | |
resources: | |
- pods/eviction | |
verbs: | |
- create | |
- apiGroups: | |
- "" | |
resources: | |
- pods/status | |
verbs: | |
- update | |
- apiGroups: | |
- "" | |
resources: | |
- endpoints | |
resourceNames: | |
- cluster-autoscaler | |
verbs: | |
- get | |
- update | |
- apiGroups: | |
- "" | |
resources: | |
- nodes | |
verbs: | |
- watch | |
- list | |
- get | |
- update | |
- apiGroups: | |
- "" | |
resources: | |
- pods | |
- services | |
- replicationcontrollers | |
- persistentvolumeclaims | |
- persistentvolumes | |
verbs: | |
- watch | |
- list | |
- get | |
- apiGroups: | |
- extensions | |
resources: | |
- replicasets | |
- daemonsets | |
verbs: | |
- watch | |
- list | |
- get | |
- apiGroups: | |
- policy | |
resources: | |
- poddisruptionbudgets | |
verbs: | |
- watch | |
- list | |
- apiGroups: | |
- apps | |
resources: | |
- statefulsets | |
verbs: | |
- watch | |
- list | |
- get | |
- apiGroups: | |
- storage.k8s.io | |
resources: | |
- storageclasses | |
verbs: | |
- watch | |
- list | |
- get | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: Role | |
metadata: | |
name: cluster-autoscaler | |
namespace: kube-system | |
labels: | |
k8s-addon: cluster-autoscaler.addons.k8s.io | |
app: cluster-autoscaler | |
rules: | |
- apiGroups: | |
- "" | |
resources: | |
- configmaps | |
verbs: | |
- create | |
- apiGroups: | |
- "" | |
resources: | |
- configmaps | |
resourceNames: | |
- cluster-autoscaler-status | |
verbs: | |
- delete | |
- get | |
- update | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: cluster-autoscaler | |
labels: | |
k8s-addon: cluster-autoscaler.addons.k8s.io | |
app: cluster-autoscaler | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: cluster-autoscaler | |
subjects: | |
- kind: ServiceAccount | |
name: cluster-autoscaler | |
namespace: kube-system | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: RoleBinding | |
metadata: | |
name: cluster-autoscaler | |
namespace: kube-system | |
labels: | |
k8s-addon: cluster-autoscaler.addons.k8s.io | |
app: cluster-autoscaler | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: Role | |
name: cluster-autoscaler | |
subjects: | |
- kind: ServiceAccount | |
name: cluster-autoscaler | |
namespace: kube-system | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: cluster-autoscaler | |
namespace: kube-system | |
labels: | |
k8s-addon: cluster-autoscaler.addons.k8s.io | |
app: cluster-autoscaler | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: cluster-autoscaler | |
template: | |
metadata: | |
labels: | |
k8s-addon: cluster-autoscaler.addons.k8s.io | |
app: cluster-autoscaler | |
annotations: | |
# For 1.6, we keep the old tolerations in case of a downgrade to 1.5 | |
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"dedicated", "value":"master"}]' | |
prometheus.io/scrape: 'true' | |
prometheus.io/port: '8085' | |
spec: | |
tolerations: | |
- effect: NoSchedule | |
key: node-role.kubernetes.io/master | |
nodeSelector: | |
kubernetes.io/role: master | |
serviceAccountName: cluster-autoscaler | |
containers: | |
- name: cluster-autoscaler | |
image: k8s.gcr.io/cluster-autoscaler:v1.1.1 | |
livenessProbe: | |
httpGet: | |
path: /health-check | |
port: 8085 | |
readinessProbe: | |
httpGet: | |
path: /health-check | |
port: 8085 | |
resources: | |
limits: | |
cpu: 100m | |
memory: 300Mi | |
requests: | |
cpu: 100m | |
memory: 300Mi | |
command: | |
- ./cluster-autoscaler | |
- --v=4 | |
- --stderrthreshold=info | |
- --cloud-provider=aws | |
- --skip-nodes-with-local-storage=false | |
- --skip-nodes-with-system-pods=false | |
- --nodes=3:6:nodes.gitlab.domain.tld | |
#- --node-group-auto-discovery=asg:tag=ca-discovery | |
#- --scale-down-unneeded-time=20m | |
#- --scale-down-utilization-threshold=0.1 | |
#- --unregistered-node-removal-time=20m | |
#- --max-total-unready-percentage=100 | |
env: | |
- name: AWS_REGION | |
value: us-west-1 | |
volumeMounts: | |
- name: ssl-certs | |
mountPath: /etc/ssl/certs/ca-certificates.crt | |
readOnly: true | |
volumes: | |
- name: ssl-certs | |
hostPath: | |
path: /etc/ssl/certs/ca-certificates.crt | |
dnsPolicy: "Default" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
nodes.gitlab.domain.tld
is the name of the ASG for the worker nodes that the cluster-autoscaler will tag with its own labels.