From 15aa8e1d5d18c3904aa95f426b0a3f4495d55b7f Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Wed, 6 Jan 2021 14:35:47 -0800 Subject: [PATCH 1/2] Enable --force-systemd for containerd runtime --- go.sum | 2 ++ pkg/minikube/cruntime/containerd.go | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/go.sum b/go.sum index e8cf12782269..6540c3a4912c 100644 --- a/go.sum +++ b/go.sum @@ -988,6 +988,8 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= +github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ultraware/funlen v0.0.1/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= diff --git a/pkg/minikube/cruntime/containerd.go b/pkg/minikube/cruntime/containerd.go index 8f269cfa9e07..8613b1d4e376 100644 --- a/pkg/minikube/cruntime/containerd.go +++ b/pkg/minikube/cruntime/containerd.go @@ -76,7 +76,7 @@ oom_score = 0 enable_selinux = false sandbox_image = "{{ .PodInfraContainerImage }}" stats_collect_period = 10 - systemd_cgroup = false + systemd_cgroup = {{ .SystemdCgroup }} enable_tls_streaming = false max_container_log_line_size = 16384 [plugins.cri.containerd] @@ -172,14 +172,20 @@ func (r *Containerd) Available() error { } // generateContainerdConfig sets up /etc/containerd/config.toml -func generateContainerdConfig(cr CommandRunner, imageRepository string, kv semver.Version) error { +func generateContainerdConfig(cr CommandRunner, imageRepository string, kv semver.Version, forceSystemd bool) error { cPath := containerdConfigFile t, err := template.New("containerd.config.toml").Parse(containerdConfigTemplate) if err != nil { return err } pauseImage := images.Pause(kv, imageRepository) - opts := struct{ PodInfraContainerImage string }{PodInfraContainerImage: pauseImage} + opts := struct { + PodInfraContainerImage string + SystemdCgroup bool + }{ + PodInfraContainerImage: pauseImage, + SystemdCgroup: forceSystemd, + } var b bytes.Buffer if err := t.Execute(&b, opts); err != nil { return err @@ -192,7 +198,7 @@ func generateContainerdConfig(cr CommandRunner, imageRepository string, kv semve } // Enable idempotently enables containerd on a host -func (r *Containerd) Enable(disOthers, _ bool) error { +func (r *Containerd) Enable(disOthers, forceSystemd bool) error { if disOthers { if err := disableOthers(r, r.Runner); err != nil { klog.Warningf("disableOthers: %v", err) @@ -201,7 +207,7 @@ func (r *Containerd) Enable(disOthers, _ bool) error { if err := populateCRIConfig(r.Runner, r.SocketPath()); err != nil { return err } - if err := generateContainerdConfig(r.Runner, r.ImageRepository, r.KubernetesVersion); err != nil { + if err := generateContainerdConfig(r.Runner, r.ImageRepository, r.KubernetesVersion, forceSystemd); err != nil { return err } if err := enableIPForwarding(r.Runner); err != nil { From 0b522445adf56d8b43f90d8c688db70153fc130b Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Wed, 6 Jan 2021 14:38:15 -0800 Subject: [PATCH 2/2] update flag and documentation --- cmd/minikube/cmd/start_flags.go | 2 +- site/content/en/docs/commands/start.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/minikube/cmd/start_flags.go b/cmd/minikube/cmd/start_flags.go index 1988677eeb42..8cd3fdc6acc0 100644 --- a/cmd/minikube/cmd/start_flags.go +++ b/cmd/minikube/cmd/start_flags.go @@ -152,7 +152,7 @@ func initMinikubeFlags() { startCmd.Flags().IntP(nodes, "n", 1, "The number of nodes to spin up. Defaults to 1.") startCmd.Flags().Bool(preload, true, "If set, download tarball of preloaded images if available to improve start time. Defaults to true.") startCmd.Flags().Bool(deleteOnFailure, false, "If set, delete the current cluster if start fails and try again. Defaults to false.") - startCmd.Flags().Bool(forceSystemd, false, "If set, force the container runtime to use sytemd as cgroup manager. Currently available for docker and crio. Defaults to false.") + startCmd.Flags().Bool(forceSystemd, false, "If set, force the container runtime to use sytemd as cgroup manager. Defaults to false.") startCmd.Flags().StringP(network, "", "", "network to run minikube with. Only available with the docker/podman drivers. If left empty, minikube will create a new network.") startCmd.Flags().StringVarP(&outputFormat, "output", "o", "text", "Format to print stdout in. Options include: [text,json]") startCmd.Flags().StringP(trace, "", "", "Send trace events. Options include: [gcp]") diff --git a/site/content/en/docs/commands/start.md b/site/content/en/docs/commands/start.md index edaea7cb3a19..aac90df39d8b 100644 --- a/site/content/en/docs/commands/start.md +++ b/site/content/en/docs/commands/start.md @@ -50,7 +50,7 @@ minikube start [flags] Valid kubeadm parameters: ignore-preflight-errors, dry-run, kubeconfig, kubeconfig-dir, node-name, cri-socket, experimental-upload-certs, certificate-key, rootfs, skip-phases, pod-network-cidr --feature-gates string A set of key=value pairs that describe feature gates for alpha/experimental features. --force Force minikube to perform possibly dangerous operations - --force-systemd If set, force the container runtime to use sytemd as cgroup manager. Currently available for docker and crio. Defaults to false. + --force-systemd If set, force the container runtime to use sytemd as cgroup manager. Defaults to false. --host-dns-resolver Enable host resolver for NAT DNS requests (virtualbox driver only) (default true) --host-only-cidr string The CIDR to be used for the minikube VM (virtualbox driver only) (default "192.168.99.1/24") --host-only-nic-type string NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only) (default "virtio")