Skip to content
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

Update probe settings #1028

Merged
merged 1 commit into from
Jun 24, 2020
Merged

Update probe settings #1028

merged 1 commit into from
Jun 24, 2020

Conversation

mogren
Copy link
Contributor

@mogren mogren commented Jun 15, 2020

Description of changes:

  • Reduce readiness probe startup delay to 1s
  • Increase liveness probe startup delay to 60, since it will only fail if the CNI fails to start, or has crashed.
  • Reduce shutdown grace period to 10 seconds

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mogren mogren requested a review from anguslees June 15, 2020 05:39
Copy link
Contributor

@anguslees anguslees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think updateStrategy.rollingUpdate.maxUnavailable=10% still requires the readiness probe to determine "Available"

@mogren
Copy link
Contributor Author

mogren commented Jun 15, 2020

Oh, you are right! We might have to revisit the time it takes though, rolling updates take a really long time currently.

@mogren mogren marked this pull request as draft June 15, 2020 07:06
@mogren mogren force-pushed the remove-readiness branch from 7b12924 to 561a38f Compare June 15, 2020 16:39
@mogren mogren changed the title Remove readiness probe Update probe settings Jun 15, 2020
@mogren mogren force-pushed the remove-readiness branch 2 times, most recently from 46c810c to 2adff93 Compare June 15, 2020 16:46
@mogren mogren marked this pull request as ready for review June 15, 2020 16:50
@mogren mogren force-pushed the remove-readiness branch from 2adff93 to cfbc3f8 Compare June 15, 2020 16:50
@mogren mogren requested a review from anguslees June 15, 2020 17:03
@anguslees
Copy link
Contributor

We might have to revisit the time it takes though

How are the new values arrived at?
(So we can point back at this PR and our original assumptions, when we next want to change these values)

@@ -154,6 +155,7 @@
"name": "cni-bin-dir"
"priorityClassName": "system-node-critical"
"serviceAccountName": "aws-node"
"terminationGracePeriodSeconds": 10
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default terminationGracePeriodSeconds is 30 seconds. The CNI does not really need any time to shut down, so reducing this to 10s.

Copy link
Contributor

@anguslees anguslees Jun 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not zero (sigkill the pod immediately)?

Copy link
Contributor Author

@mogren mogren Jun 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I did set it at 10s on purpose to avoid leaking ENIs. There is a shutdown hook and that flag is checked before trying to free or add an ENI. If the shutdown happens just when ipamd has detached an ENI, but before it has deleted it, we would "leak" it. It usually takes around 2 seconds for the detach to complete, but p99 is 10s according to EC2. Same for creating ENIs, we want the create to complete and the ENI to be attached to the node (with the delete on termination flag set) so that it gets cleaned up if the node terminates.

That said, i don't think we have done enough testing on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(:rocket: This is exactly the sort of analysis I was hoping to capture)

config/master/aws-k8s-cni-cn.yaml Outdated Show resolved Hide resolved
config/master/aws-k8s-cni-cn.yaml Outdated Show resolved Hide resolved
@mogren mogren force-pushed the remove-readiness branch 2 times, most recently from 3d8d14a to 3c24f2b Compare June 17, 2020 22:44
@@ -121,7 +121,7 @@
"command":
- "/app/grpc-health-probe"
- "-addr=:50051"
"initialDelaySeconds": 35
"initialDelaySeconds": 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helped a lot! I tested on a cluster with 50 pods on 3 nodes:

kube-system   aws-node-2ph8t              0/1     ContainerCreating   0          1s      
kube-system   aws-node-2ph8t              1/1     Running             0          3s 

@mogren mogren force-pushed the remove-readiness branch from 3c24f2b to 9bd02ec Compare June 18, 2020 06:06
@mogren mogren requested review from jaypipes, haouc and jayanthvn June 18, 2020 20:04
Copy link
Contributor

@haouc haouc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks.

@mogren mogren force-pushed the remove-readiness branch from 9bd02ec to 21bf401 Compare June 19, 2020 20:36
@mogren mogren dismissed anguslees’s stale review June 22, 2020 16:21

Changes addressed 5 days ago :)

@@ -154,6 +155,7 @@
"name": "cni-bin-dir"
"priorityClassName": "system-node-critical"
"serviceAccountName": "aws-node"
"terminationGracePeriodSeconds": 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(:rocket: This is exactly the sort of analysis I was hoping to capture)

exec: {
command: ["/app/grpc-health-probe", "-addr=:50051"],
},
initialDelaySeconds: 60,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says "Increase liveness polling period". I think this PR increases the liveness initial delay period however - which one was intended? (I suspect this should have been periodSeconds=60)

(Separately) jsonnet style tip: You can "merge" values with +. Since liveness/readiness probes are very similar, I would do this as:

livenessProbe: self.readinessProbe + {
    initialDelaySeconds: 60, // If desired, but see above comment
    periodSeconds: 60,
},

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix the comment. I think, like you said in #1028 (comment), that we should just increase the initial timeout, but keep the period at the default in order to catch issues that happen after startup faster. That should give the aws-node about 90 seconds to get started, after a 60 s startup delay and three 10 s liveness probes.

@mogren mogren force-pushed the remove-readiness branch from 21bf401 to 7b643a2 Compare June 23, 2020 05:29
@mogren
Copy link
Contributor Author

mogren commented Jun 23, 2020

We will need to bump this time as well:

# Checks for IPAM connectivity on localhost port 50051, retrying connectivity
# check with a timeout of 36 seconds
wait_for_ipam() {
local __sleep_time=0
until [ $__sleep_time -eq 8 ]; do
sleep $((__sleep_time++))
if ./grpc-health-probe -addr 127.0.0.1:50051 >/dev/null 2>&1; then
return 0
fi
done
return 1
}

* Reduce readiness probe startup delay
* Increase liveness polling period
* Reduce shutdown grace period to 10 seconds
@mogren mogren force-pushed the remove-readiness branch from 7b643a2 to 9c28436 Compare June 24, 2020 06:07
@mogren mogren merged commit 9fea153 into aws:master Jun 24, 2020
@mogren mogren deleted the remove-readiness branch June 24, 2020 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants