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

Enable CNI for alternative runtimes #3617

Merged
merged 8 commits into from
Feb 11, 2019
18 changes: 15 additions & 3 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,12 @@ func runStart(cmd *cobra.Command, args []string) {
cmdutil.MaybeReportErrorAndExit(err)
}

selectedContainerRuntime := viper.GetString(containerRuntime)
selectedNetworkPlugin := viper.GetString(networkPlugin)
selectedEnableDefaultCNI := viper.GetBool(enableDefaultCNI)

// common config (currently none)
var cricfg = map[string]string{}
selectedContainerRuntime := viper.GetString(containerRuntime)
if cricfg := SetContainerRuntime(cricfg, selectedContainerRuntime); cricfg != nil {
var command string
fmt.Println("Writing crictl config...")
Expand All @@ -232,6 +235,15 @@ func runStart(cmd *cobra.Command, args []string) {
glog.Errorln("Error writing crictl config: ", err)
}
}
// default network plugin (cni)
if selectedContainerRuntime != "" {
afbjorklund marked this conversation as resolved.
Show resolved Hide resolved
if !cmd.Flags().Changed(networkPlugin) {
selectedNetworkPlugin = "cni"
if !cmd.Flags().Changed(enableDefaultCNI) {
selectedEnableDefaultCNI = true
}
}
}

selectedKubernetesVersion := viper.GetString(kubernetesVersion)
if strings.Compare(selectedKubernetesVersion, "") == 0 {
Expand Down Expand Up @@ -267,11 +279,11 @@ func runStart(cmd *cobra.Command, args []string) {
FeatureGates: viper.GetString(featureGates),
ContainerRuntime: selectedContainerRuntime,
CRISocket: viper.GetString(criSocket),
NetworkPlugin: viper.GetString(networkPlugin),
NetworkPlugin: selectedNetworkPlugin,
ServiceCIDR: viper.GetString(serviceCIDR),
ExtraOptions: extraOptions,
ShouldLoadCachedImages: shouldCacheImages,
EnableDefaultCNI: viper.GetBool(enableDefaultCNI),
EnableDefaultCNI: selectedEnableDefaultCNI,
}

k8sBootstrapper, err := GetClusterBootstrapper(api, clusterBootstrapper)
Expand Down
21 changes: 5 additions & 16 deletions docs/alternative_runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
To use [rkt](https://github.com/coreos/rkt) as the container runtime run:

```shell
$ minikube start \
--network-plugin=cni \
--enable-default-cni \
--container-runtime=rkt
$ minikube start --container-runtime=rkt
```


Expand All @@ -15,19 +12,15 @@ $ minikube start \
To use [CRI-O](https://github.com/kubernetes-incubator/cri-o) as the container runtime, run:

```shell
$ minikube start \
--network-plugin=cni \
--enable-default-cni \
--container-runtime=cri-o
$ minikube start --container-runtime=cri-o
afbjorklund marked this conversation as resolved.
Show resolved Hide resolved
```

Or you can use the extended version:

```shell
$ minikube start \
$ minikube start --container-runtime=cri-o \
--network-plugin=cni \
--enable-default-cni \
--container-runtime=cri-o \
--cri-socket=/var/run/crio/crio.sock \
--extra-config=kubelet.container-runtime=remote \
--extra-config=kubelet.container-runtime-endpoint=unix:///var/run/crio/crio.sock \
Expand All @@ -39,19 +32,15 @@ $ minikube start \
To use [containerd](https://github.com/containerd/containerd) as the container runtime, run:

```shell
$ minikube start \
--network-plugin=cni \
--enable-default-cni \
--container-runtime=containerd
$ minikube start --container-runtime=containerd
```

Or you can use the extended version:

```shell
$ minikube start \
$ minikube start --container-runtime=containerd \
--network-plugin=cni \
--enable-default-cni \
--container-runtime=containerd \
--cri-socket=/run/containerd/containerd.sock \
--extra-config=kubelet.container-runtime=remote \
--extra-config=kubelet.container-runtime-endpoint=unix:///run/containerd/containerd.sock \
Expand Down