Skip to content

Commit c7e69fd

Browse files
committed
Allow ServiceCIDR to be configured via 'service-cluster-ip-range' flag.
1 parent 5d910e8 commit c7e69fd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cmd/minikube/cmd/start.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const (
6767
featureGates = "feature-gates"
6868
apiServerName = "apiserver-name"
6969
dnsDomain = "dns-domain"
70+
serviceCIDR = "service-cluster-ip-range"
7071
mountString = "mount-string"
7172
disableDriverMounts = "disable-driver-mounts"
7273
cacheImages = "cache-images"
@@ -234,7 +235,7 @@ func runStart(cmd *cobra.Command, args []string) {
234235
ContainerRuntime: viper.GetString(containerRuntime),
235236
CRISocket: viper.GetString(criSocket),
236237
NetworkPlugin: viper.GetString(networkPlugin),
237-
ServiceCIDR: pkgutil.DefaultServiceCIDR,
238+
ServiceCIDR: viper.GetString(serviceCIDR),
238239
ExtraOptions: extraOptions,
239240
ShouldLoadCachedImages: shouldCacheImages,
240241
}
@@ -473,6 +474,7 @@ func init() {
473474
startCmd.Flags().StringArrayVar(&apiServerNames, "apiserver-names", nil, "A set of apiserver names which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine")
474475
startCmd.Flags().IPSliceVar(&apiServerIPs, "apiserver-ips", nil, "A set of apiserver IP Addresses which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine")
475476
startCmd.Flags().String(dnsDomain, constants.ClusterDNSDomain, "The cluster dns domain name used in the kubernetes cluster")
477+
startCmd.Flags().String(serviceCIDR, pkgutil.DefaultServiceCIDR, "The CIDR to be used for service cluster IPs.")
476478
startCmd.Flags().StringSliceVar(&insecureRegistry, "insecure-registry", nil, "Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.")
477479
startCmd.Flags().StringSliceVar(&registryMirror, "registry-mirror", nil, "Registry mirrors to pass to the Docker daemon")
478480
startCmd.Flags().String(containerRuntime, "", "The container runtime to be used")

pkg/minikube/bootstrapper/kubeadm/kubeadm.go

+4
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ func generateConfig(k8s config.KubernetesConfig) (string, error) {
438438
NoTaintMaster: false, // That does not work with k8s 1.12+
439439
}
440440

441+
if k8s.ServiceCIDR != "" {
442+
opts.ServiceCIDR = k8s.ServiceCIDR
443+
}
444+
441445
if version.GTE(semver.MustParse("1.10.0-alpha.0")) {
442446
opts.NoTaintMaster = true
443447
}

0 commit comments

Comments
 (0)