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

docs(kubernetes): explain readiness probe #58

Merged
merged 5 commits into from
Jun 29, 2018
Merged

Conversation

gergelyke
Copy link
Collaborator

No description provided.

README.md Outdated
```javascript
function beforeShutdown () {
// given your readiness probes run every 5 second
// may worth using a bigger number so you won't

Choose a reason for hiding this comment

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

Nit: "may be worth using"

README.md Outdated

During that time window (30 seconds by default), the pod is in the `terminating` state and will be removed from any Services by a controller. The pod itself needs to catch the `SIGTERM` signal, and start failing any readiness probes.

During this time, it is possible that load-balancers don't remove the pods "in time", and when the pod dies, it kills live connections.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this specific to the nginx ingress controller? Or do other implementations also have this result?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

afaik, this is how all implementations work

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

any chance @peterkuiper or @thockin that you can verify that?

Copy link

Choose a reason for hiding this comment

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

I think its relevant because the service itself can be a single IP that fronts the pods and it won't be taken out of the DNS pool until readiness check tells it.

Copy link
Contributor

Choose a reason for hiding this comment

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

the nginx ingress controller routes directly to Pods (not via the Service). If it routed via the Service, we wouldn't have this issue (https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/)

Copy link
Contributor

Choose a reason for hiding this comment

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

README.md Outdated

When a pod is deleted, Kubernetes will notify it and will wait for `gracePeriod` seconds before killing it.

During that time window (30 seconds by default), the pod is in the `terminating` state and will be removed from any Services by a controller. The pod itself needs to catch the `SIGTERM` signal, and start failing any readiness probes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same q as below -- Do i only need to be concerned about this with the nginx ingress controller? If I've configured my Service to use a NodePort or something, then I don't need to worry, correct?

README.md Outdated
// may worth using a bigger number so you won't
// run into any race conditions
return Promise(resolve => {
setTimeout(5000, resolve)

Choose a reason for hiding this comment

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

based off the function signature on MDN, should be setTimeout(resolve, 5000) https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

omg, thanks, great catch Mayank!

README.md Outdated
@@ -103,6 +103,32 @@ terminus(server, options);
server.listen(PORT || 3000);
```

## How to set Terminus up with Kubernetes?

When a pod is deleted, Kubernetes will notify it and will wait for `gracePeriod` seconds before killing it.

Choose a reason for hiding this comment

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

nit: ... Kubernetes will notify it and wait for ... (removes double use of will)

README.md Outdated

When a pod is deleted, Kubernetes will notify it and wait for `gracePeriod` seconds before killing it.

During that time window (30 seconds by default), the pod is in the `terminating` state and will be removed from any Services by a controller. The pod itself needs to catch the `SIGTERM` signal and start failing any readiness probes.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should come after the description about why a terminating pod (that is removed from a service) might still receive requests.

README.md Outdated
@@ -103,10 +103,38 @@ terminus(server, options);
server.listen(PORT || 3000);
```

## How to set Terminus up with Kubernetes?

When a pod is deleted, Kubernetes will notify it and wait for `gracePeriod` seconds before killing it.
Copy link
Contributor

Choose a reason for hiding this comment

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

pod -> Pod

README.md Outdated

During that time window (30 seconds by default), the pod is in the `terminating` state and will be removed from any Services by a controller. The pod itself needs to catch the `SIGTERM` signal and start failing any readiness probes.

During this time, it is possible that load-balancers don't remove the pods "in time", and when the pod dies, it kills live connections.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give a specific example of "load-balancer". e.g., the nginx ingress controller.

@gergelyke gergelyke merged commit 3b29adb into master Jun 29, 2018
@gergelyke gergelyke deleted the docs/kub-liveness branch June 29, 2018 19:44
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.

5 participants