-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support addon Deployments, make heapster a deployment with a nanny. #22893
Changes from all commits
79f0cc2
c484563
0c22277
81ba98a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
{% set metrics_memory = "200Mi" -%} | ||
{% set eventer_memory = "200Mi" -%} | ||
{% set metrics_memory_per_node = 4 -%} | ||
{% set eventer_memory_per_node = 500 -%} | ||
{% set num_nodes = pillar.get('num_nodes', -1) -%} | ||
{% if num_nodes >= 0 -%} | ||
{% set metrics_memory = (200 + num_nodes * 4)|string + "Mi" -%} | ||
{% set eventer_memory = (200 * 1024 + num_nodes * 500)|string + "Ki" -%} | ||
{% set metrics_memory = (200 + num_nodes * metrics_memory_per_node)|string + "Mi" -%} | ||
{% set eventer_memory = (200 * 1024 + num_nodes * eventer_memory_per_node)|string + "Ki" -%} | ||
{% endif -%} | ||
|
||
apiVersion: v1 | ||
kind: ReplicationController | ||
apiVersion: extensions/v1beta1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please reuse constants above and in the nanny? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
kind: Deployment | ||
metadata: | ||
name: heapster-v1.0.0 | ||
name: heapster | ||
namespace: kube-system | ||
labels: | ||
k8s-app: heapster | ||
kubernetes.io/cluster-service: "true" | ||
spec: | ||
replicas: 1 | ||
selector: | ||
k8s-app: heapster | ||
matchLabels: | ||
k8s-app: heapster | ||
template: | ||
metadata: | ||
labels: | ||
|
@@ -62,6 +65,62 @@ spec: | |
- name: ssl-certs | ||
mountPath: /etc/ssl/certs | ||
readOnly: true | ||
- image: gcr.io/google_containers/addon-resizer:1.0 | ||
name: heapster-nanny | ||
resources: | ||
limits: | ||
cpu: 50m | ||
memory: 100Mi | ||
requests: | ||
cpu: 50m | ||
memory: 100Mi | ||
env: | ||
- name: MY_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: MY_POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
command: | ||
- /pod_nanny | ||
- --cpu=100m | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mwielgus Please verify these values based on your perf tests. AFAIR we need more than 100m cpu in large clusters and 4MB of memory for each node. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 1.2 cut gives 4MB per node, but leaves CPU at 100m. I've changed this to use the same per-node value as static sizing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On 1000 node cluster we are using 50 millis on average with occasional spikes to 500 (every minute for a couple seconds). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this define? |
||
- --extra-cpu=0m | ||
- --memory={{ metrics_memory }} | ||
- --extra-memory={{metrics_memory_per_node}}Mi | ||
- --threshold=5 | ||
- --deployment=heapster | ||
- --container=heapster | ||
- --poll-period=300000 | ||
- image: gcr.io/google_containers/addon-resizer:1.0 | ||
name: eventer-nanny | ||
resources: | ||
limits: | ||
cpu: 50m | ||
memory: 100Mi | ||
requests: | ||
cpu: 50m | ||
memory: 100Mi | ||
env: | ||
- name: MY_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: MY_POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
command: | ||
- /pod_nanny | ||
- --cpu=100m | ||
- --extra-cpu=0m | ||
- --memory={{eventer_memory}} | ||
- --extra-memory={{eventer_memory_per_node}}Ki | ||
- --threshold=5 | ||
- --deployment=heapster | ||
- --container=eventer | ||
- --poll-period=300000 | ||
volumes: | ||
- name: ssl-certs | ||
hostPath: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
{% set metrics_memory = "200Mi" -%} | ||
{% set eventer_memory = "200Mi" -%} | ||
{% set metrics_memory_per_node = 4 -%} | ||
{% set eventer_memory_per_node = 500 -%} | ||
{% set num_nodes = pillar.get('num_nodes', -1) -%} | ||
{% if num_nodes >= 0 -%} | ||
{% set metrics_memory = (200 + num_nodes * 4)|string + "Mi" -%} | ||
{% set eventer_memory = (200 * 1024 + num_nodes * 500)|string + "Ki" -%} | ||
{% set metrics_memory = (200 + num_nodes * metrics_memory_per_node)|string + "Mi" -%} | ||
{% set eventer_memory = (200 * 1024 + num_nodes * eventer_memory_per_node)|string + "Ki" -%} | ||
{% endif -%} | ||
|
||
apiVersion: v1 | ||
kind: ReplicationController | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: heapster-v1.0.0 | ||
name: heapster | ||
namespace: kube-system | ||
labels: | ||
k8s-app: heapster | ||
kubernetes.io/cluster-service: "true" | ||
spec: | ||
replicas: 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this only has 1 replica, you might consider the Recreate update policy. The default is RollingUpdate. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting idea. The code for the container in question lives in contrib/addon-resizer, where that would be an easy (1-line) change. I'll definitely consider it. |
||
selector: | ||
k8s-app: heapster | ||
matchLabels: | ||
k8s-app: heapster | ||
template: | ||
metadata: | ||
labels: | ||
|
@@ -63,6 +66,62 @@ spec: | |
- name: ssl-certs | ||
mountPath: /etc/ssl/certs | ||
readOnly: true | ||
- image: gcr.io/google_containers/addon-resizer:1.0 | ||
name: heapster-nanny | ||
resources: | ||
limits: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you just specify limits, request should be set from limits. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #18216 added requests to all addons. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the config best practices is:
I don't really understand the argument behind #18216 but it seems to violate that best practice. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then why don't we do this for other singletons (e.g., heapster itself)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of #18216. Can you explain why this is important @gmarek? Here's the defaulting code https://github.com/kubernetes/kubernetes/blob/master/pkg/api/v1/defaults.go#L99-L116 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we were designing QoS we decided to have this defaulting as a backward compatibility feature. I didn't had impression that it's there to stay forever, so I think we should have requests explicit. Generally all those QoS stuff is really confusing as it is today. @piosz There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting: I didn't know about that default behavior. It actually conflicts with the addon-resizer, which explicitly sets requests=limits to keep its dependents in the guaranteed class. The addon-resizer also performs an update on any qualitative difference (e.g., requests being expected but not found). This would manifest as a single deployment update at startup. It feels weird to add a flag to disregard requests, but we'll need to if we want to utilize this default behavior. But since literally all of our addons specify both requests and limits, why don't I cut an issue for 1.3 to rectify both the pod_nanny and all of our addon yamls with best practices? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is another proof that the current state is confusing. We should work on that at some point. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened #23229 |
||
cpu: 50m | ||
memory: 100Mi | ||
requests: | ||
cpu: 50m | ||
memory: 100Mi | ||
env: | ||
- name: MY_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: MY_POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
command: | ||
- /pod_nanny | ||
- --cpu=100m | ||
- --extra-cpu=0m | ||
- --memory={{ metrics_memory }} | ||
- --extra-memory={{ metrics_memory_per_node }}Mi | ||
- --threshold=5 | ||
- --deployment=heapster | ||
- --container=heapster | ||
- --poll-period=300000 | ||
- image: gcr.io/google_containers/addon-resizer:1.0 | ||
name: eventer-nanny | ||
resources: | ||
limits: | ||
cpu: 50m | ||
memory: 100Mi | ||
requests: | ||
cpu: 50m | ||
memory: 100Mi | ||
env: | ||
- name: MY_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: MY_POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
command: | ||
- /pod_nanny | ||
- --cpu=100m | ||
- --extra-cpu=0m | ||
- --memory={{ eventer_memory }} | ||
- --extra-memory={{ eventer_memory_per_node }}Ki | ||
- --threshold=5 | ||
- --deployment=heapster | ||
- --container=eventer | ||
- --poll-period=300000 | ||
volumes: | ||
- name: ssl-certs | ||
hostPath: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
{% set metrics_memory = "200Mi" -%} | ||
{% set metrics_memory_per_node = 4 -%} | ||
{% set num_nodes = pillar.get('num_nodes', -1) -%} | ||
{% if num_nodes >= 0 -%} | ||
{% set metrics_memory = (200 + num_nodes * 4)|string + "Mi" -%} | ||
{% set metrics_memory = (200 + num_nodes * metrics_memory_per_node)|string + "Mi" -%} | ||
{% endif -%} | ||
|
||
apiVersion: v1 | ||
kind: ReplicationController | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: heapster-v1.0.0 | ||
name: heapster | ||
namespace: kube-system | ||
labels: | ||
k8s-app: heapster | ||
kubernetes.io/cluster-service: "true" | ||
spec: | ||
replicas: 1 | ||
selector: | ||
k8s-app: heapster | ||
matchLabels: | ||
k8s-app: heapster | ||
template: | ||
metadata: | ||
labels: | ||
|
@@ -37,3 +39,31 @@ spec: | |
- /heapster | ||
- --source=kubernetes.summary_api:'' | ||
- --metric_resolution=60s | ||
- image: gcr.io/google_containers/addon-resizer:1.0 | ||
name: heapster-nanny | ||
resources: | ||
limits: | ||
cpu: 50m | ||
memory: 100Mi | ||
requests: | ||
cpu: 50m | ||
memory: 100Mi | ||
env: | ||
- name: MY_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: MY_POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
command: | ||
- /pod_nanny | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does pod_nanny do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It vertically scales a container based on the number of nodes. |
||
- --cpu=100m | ||
- --extra-cpu=0m | ||
- --memory={{ metrics_memory }} | ||
- --extra-memory={{ metrics_memory_per_node }}Mi | ||
- --threshold=5 | ||
- --deployment=heapster | ||
- --container=heapster | ||
- --poll-period=300000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -481,6 +481,7 @@ function update-addons() { | |
# That's why we pass an empty string as the version separator. | ||
# If the description differs on disk, the object should be recreated. | ||
# This is not implemented in this version. | ||
reconcile-objects ${addon_path} Deployment "" & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this going to update Deployments? AFAIU name for an object will not change, so how addon-updater will realise it has to do an update? Has this been tested? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ping @Q-Lee |
||
reconcile-objects ${addon_path} Service "" & | ||
reconcile-objects ${addon_path} PersistentVolume "" & | ||
reconcile-objects ${addon_path} PersistentVolumeClaim "" & | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit to the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't, because I use this constant in math down below. Unless you mean something like "metrics_memory_per_node_unit"?