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

Add 'pause' command to freeze Kubernetes cluster #5962

Merged
merged 21 commits into from
Jan 24, 2020

Conversation

tstromberg
Copy link
Contributor

@tstromberg tstromberg commented Nov 23, 2019

Uses the cgroups freezer to reduce minikube's CPU overhead from 30-40% of a core to 1-2% of a core.

By default, it only pauses namespaces populated by minikube, so that applications running on top remain running. This behavior can be overridden by passing -A, similar to kubectl, or by passing --namespaces.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 23, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tstromberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 23, 2019
@afbjorklund
Copy link
Collaborator

This change would look nicer if we fixed #5677 first.

@blueelvis
Copy link
Contributor

What if we pause the VM in its entirety and then resume it?

pkg/minikube/config/profile.go.orig Outdated Show resolved Hide resolved
cmd/minikube/cmd/pause.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/pause.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/unpause.go Outdated Show resolved Hide resolved
pkg/minikube/pause/pause.go Outdated Show resolved Hide resolved
@tstromberg tstromberg modified the milestone: v1.7.0-candidate Dec 9, 2019
@tstromberg
Copy link
Contributor Author

What if we pause the VM in its entirety and then resume it?

I decided against this approach, for a number of reasons:

  • This allows us to pause Kubernetes without pausing the apps running on top of Kubernetes. The intent is for a follow-up PR to allow for pausing only Kubernetes by default, but also allowing -A and --namespace arguments.
  • The diifference between pausing the VM and pausing containers is negligible (<5% of a core)
  • libmachine doesn't support suspend/resume

@medyagh
Copy link
Member

medyagh commented Jan 13, 2020

@tstromberg are you still wokring on this ?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 13, 2020
@tstromberg
Copy link
Contributor Author

@medyagh - Yes.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 22, 2020
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 22, 2020
@tstromberg tstromberg changed the title WIP: Add 'pause' command to freeze Kubernetes cluster Add 'pause' command to freeze Kubernetes cluster Jan 22, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 22, 2020
cmd/minikube/cmd/status.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 22, 2020
@codecov-io
Copy link

codecov-io commented Jan 23, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@5f0420f). Click here to learn what that means.
The diff coverage is 15.66%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #5962   +/-   ##
========================================
  Coverage          ?   37.6%           
========================================
  Files             ?     127           
  Lines             ?    8562           
  Branches          ?       0           
========================================
  Hits              ?    3220           
  Misses            ?    4923           
  Partials          ?     419
Impacted Files Coverage Δ
pkg/minikube/bootstrapper/images/images.go 100% <ø> (ø)
pkg/minikube/logs/logs.go 2.35% <ø> (ø)
pkg/minikube/assets/addons.go 37.93% <ø> (ø)
pkg/minikube/config/profile.go 70.1% <ø> (ø)
cmd/minikube/cmd/status.go 6.89% <0%> (ø)
cmd/minikube/cmd/pause.go 8.1% <0%> (ø)
cmd/minikube/cmd/unpause.go 7.89% <0%> (ø)
pkg/minikube/cluster/pause.go 0% <0%> (ø)
pkg/addons/addons.go 26.05% <0%> (ø)
pkg/minikube/cruntime/docker.go 37.6% <0%> (ø)
... and 1 more

@tstromberg
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jan 23, 2020
@minikube-pr-bot
Copy link

Error: running mkcmp: exit status 1

@medyagh
Copy link
Member

medyagh commented Jan 23, 2020

/ok-to-test

cmd/minikube/cmd/pause.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/unpause.go Outdated Show resolved Hide resolved
Copy link

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

Tried locally with docker and it looks good! Just a couple comments.

cmd/minikube/cmd/status.go Show resolved Hide resolved
pkg/minikube/cluster/pause.go Show resolved Hide resolved
@minikube-pr-bot
Copy link

All Times minikube: [ 97.815426 98.333187 94.732535]
All Times Minikube (PR 5962): [ 98.485204 95.437083 95.348961]

Average minikube: 96.960382
Average Minikube (PR 5962): 96.423749

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 5962) |
+----------------------+-----------+--------------------+
| minikube v           |  0.316998 |           0.291200 |
| Creating kvm2        | 19.829913 |          19.465774 |
| Preparing Kubernetes | 49.272115 |          49.516292 |
| Pulling images       |  4.068309 |           3.271847 |
| Launching Kubernetes | 19.760251 |          20.620153 |
| Waiting for cluster  |  3.062247 |           2.722973 |
+----------------------+-----------+--------------------+

@tstromberg tstromberg merged commit 34e4c19 into kubernetes:master Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants