提交 f0479872 编写于 作者: S Sharif Elgamal

Merge branch 'master' of github.com:kubernetes/minikube into ip-save

......@@ -13,7 +13,6 @@ approvers:
- tstromberg
- afbjorklund
- sharifelgamal
- RA489
- medyagh
- josedonizetti
- priyawadhwa
......
......@@ -271,7 +271,10 @@ func deleteProfile(profile *config.Profile) error {
// if driver is oci driver, delete containers and volumes
if driver.IsKIC(profile.Config.Driver) {
out.T(out.DeletingHost, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver})
deletePossibleKicLeftOver(profile.Name, profile.Config.Driver)
for _, n := range profile.Config.Nodes {
machineName := driver.MachineName(*profile.Config, n)
deletePossibleKicLeftOver(machineName, profile.Config.Driver)
}
}
} else {
glog.Infof("%s has no configuration, will try to make it work anyways", profile.Name)
......
......@@ -56,7 +56,6 @@ import (
"k8s.io/minikube/pkg/minikube/node"
"k8s.io/minikube/pkg/minikube/notify"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/proxy"
"k8s.io/minikube/pkg/minikube/registry"
"k8s.io/minikube/pkg/minikube/translate"
"k8s.io/minikube/pkg/util"
......@@ -317,7 +316,8 @@ func startWithDriver(starter node.Starter, existing *config.ClusterConfig) (*kub
}
func warnAboutMultiNode() {
out.WarningT("Multi-node clusters are currently experimental and might exhibit unintended behavior.\nTo track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.")
out.WarningT("Multi-node clusters are currently experimental and might exhibit unintended behavior.")
out.T(out.Documentation, "To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.")
}
func updateDriver(driverName string) {
......@@ -909,24 +909,6 @@ func createNode(cc config.ClusterConfig, kubeNodeName string, existing *config.C
return cc, cp, nil
}
// setDockerProxy sets the proxy environment variables in the docker environment.
func setDockerProxy() {
for _, k := range proxy.EnvVars {
if v := os.Getenv(k); v != "" {
// convert https_proxy to HTTPS_PROXY for linux
// TODO (@medyagh): if user has both http_proxy & HTTPS_PROXY set merge them.
k = strings.ToUpper(k)
if k == "HTTP_PROXY" || k == "HTTPS_PROXY" {
if strings.HasPrefix(v, "localhost") || strings.HasPrefix(v, "127.0") {
out.WarningT("Not passing {{.name}}={{.value}} to docker env.", out.V{"name": k, "value": v})
continue
}
}
config.DockerEnv = append(config.DockerEnv, fmt.Sprintf("%s=%s", k, v))
}
}
}
// autoSetDriverOptions sets the options needed for specific driver automatically.
func autoSetDriverOptions(cmd *cobra.Command, drvName string) (err error) {
err = nil
......
......@@ -36,6 +36,7 @@ import (
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/proxy"
pkgutil "k8s.io/minikube/pkg/util"
"k8s.io/minikube/pkg/version"
)
......@@ -340,8 +341,8 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
// Feed Docker our host proxy environment by default, so that it can pull images
// doing this for both new config and existing, in case proxy changed since previous start
if _, ok := r.(*cruntime.Docker); ok && !cmd.Flags().Changed("docker-env") {
setDockerProxy()
if _, ok := r.(*cruntime.Docker); ok {
proxy.SetDockerEnv()
}
var kubeNodeName string
......
......@@ -10,7 +10,11 @@ spec:
type: ClusterIP
ports:
- port: 80
name: http
targetPort: 5000
- port: 443
name: https
targetPort: 443
selector:
actual-registry: "true"
kubernetes.io/minikube-addons: registry
......@@ -34,7 +34,7 @@ define RUNC_MASTER_CONFIGURE_CMDS
endef
define RUNC_MASTER_BUILD_CMDS
PWD=$(RUNC_MASTER_COMPILE_SRC) $(RUNC_MASTER_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) BUILDTAGS="$(RUNC_MASTER_GOTAGS)" COMMIT_NO=$(RUNC_MASTER_VERSION) PREFIX=/usr
PWD=$(RUNC_MASTER_COMPILE_SRC) $(RUNC_MASTER_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) BUILDTAGS="$(RUNC_MASTER_GOTAGS)" COMMIT_NO=$(RUNC_MASTER_VERSION) COMMIT=$(RUNC_MASTER_VERSION) PREFIX=/usr
endef
define RUNC_MASTER_INSTALL_TARGET_CMDS
......
......@@ -290,7 +290,7 @@ func TestStartHostConfig(t *testing.T) {
for i := range h.HostOptions.EngineOptions.Env {
if h.HostOptions.EngineOptions.Env[i] != cfg.DockerEnv[i] {
t.Fatal("Docker env variables were not set!")
t.Fatalf("Docker env variables were not set! got %+v but want %+v", h.HostOptions.EngineOptions.Env, cfg.DockerEnv)
}
}
......
......@@ -99,7 +99,7 @@ func DeleteHost(api libmachine.API, machineName string, deleteAbandoned ...bool)
return delete(api, host, machineName)
}
// delete removes a host and it's local data files
// delete removes a host and its local data files
func delete(api libmachine.API, h *host.Host, machineName string) error {
if err := h.Driver.Remove(); err != nil {
glog.Warningf("remove failed, will retry: %v", err)
......
......@@ -39,6 +39,7 @@ import (
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/proxy"
"k8s.io/minikube/pkg/minikube/registry"
"k8s.io/minikube/pkg/minikube/vmpath"
"k8s.io/minikube/pkg/util/lock"
......@@ -89,9 +90,25 @@ func StartHost(api libmachine.API, cfg *config.ClusterConfig, n *config.Node) (*
return h, exists, err
}
// engineOptions returns docker engine options for the dockerd running inside minikube
func engineOptions(cfg config.ClusterConfig) *engine.Options {
// get docker env from user's proxy settings
dockerEnv := proxy.SetDockerEnv()
// get docker env from user specifiec config
dockerEnv = append(dockerEnv, cfg.DockerEnv...)
// remove duplicates
seen := map[string]bool{}
uniqueEnvs := []string{}
for e := range dockerEnv {
if !seen[dockerEnv[e]] {
seen[dockerEnv[e]] = true
uniqueEnvs = append(uniqueEnvs, dockerEnv[e])
}
}
o := engine.Options{
Env: cfg.DockerEnv,
Env: uniqueEnvs,
InsecureRegistry: append([]string{constants.DefaultServiceCIDR}, cfg.InsecureRegistry...),
RegistryMirror: cfg.RegistryMirror,
ArbitraryFlags: cfg.DockerOpt,
......
......@@ -153,11 +153,8 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
prepareNone()
}
// TODO: existing cluster should wait for health #7597
if !starter.PreExists {
if err := bs.WaitForNode(*starter.Cfg, *starter.Node, viper.GetDuration(waitTimeout)); err != nil {
return nil, errors.Wrap(err, "Wait failed")
}
if err := bs.WaitForNode(*starter.Cfg, *starter.Node, viper.GetDuration(waitTimeout)); err != nil {
return nil, errors.Wrap(err, "Wait failed")
}
} else {
if err := bs.UpdateNode(*starter.Cfg, *starter.Node, cr); err != nil {
......@@ -403,7 +400,8 @@ func validateNetwork(h *host.Host, r command.Runner, imageRepository string) (st
ipExcluded := proxy.IsIPExcluded(ip) // Skip warning if minikube ip is already in NO_PROXY
k = strings.ToUpper(k) // for http_proxy & https_proxy
if (k == "HTTP_PROXY" || k == "HTTPS_PROXY") && !ipExcluded && !warnedOnce {
out.WarningT("You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP ({{.ip_address}}). Please see {{.documentation_url}} for more details", out.V{"ip_address": ip, "documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"})
out.WarningT("You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP ({{.ip_address}}).", out.V{"ip_address": ip})
out.T(out.Documentation, "Please see {{.documentation_url}} for more details", out.V{"documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"})
warnedOnce = true
}
}
......
......@@ -26,6 +26,8 @@ import (
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/client-go/rest"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/out"
)
// EnvVars are variables we plumb through to the underlying container runtime
......@@ -149,3 +151,34 @@ func UpdateTransport(cfg *rest.Config) *rest.Config {
}
return cfg
}
// SetDockerEnv sets the proxy environment variables in the docker environment.
func SetDockerEnv() []string {
for _, k := range EnvVars {
if v := os.Getenv(k); v != "" {
// convert https_proxy to HTTPS_PROXY for linux
// TODO (@medyagh): if user has both http_proxy & HTTPS_PROXY set merge them.
k = strings.ToUpper(k)
if k == "HTTP_PROXY" || k == "HTTPS_PROXY" {
if strings.HasPrefix(v, "localhost") || strings.HasPrefix(v, "127.0") {
out.WarningT("Not passing {{.name}}={{.value}} to docker env.", out.V{"name": k, "value": v})
continue
}
}
config.DockerEnv = append(config.DockerEnv, fmt.Sprintf("%s=%s", k, v))
}
}
// remove duplicates
seen := map[string]bool{}
uniqueEnvs := []string{}
for e := range config.DockerEnv {
if !seen[config.DockerEnv[e]] {
seen[config.DockerEnv[e]] = true
uniqueEnvs = append(uniqueEnvs, config.DockerEnv[e])
}
}
config.DockerEnv = uniqueEnvs
return config.DockerEnv
}
......@@ -8,7 +8,7 @@ description: >
---
Community triage takes place **every Wednesday** from **11AM-12PM PST**.
Zoom link: https://zoom.us/j/5042173647
Hangouts link: https://meet.google.com/ikf-fvrs-eer
All community members are welcome and encouraged to join and help us triage minikube!
......
......@@ -56,6 +56,13 @@ If the [Brew Package Manager](https://brew.sh/) installed:
brew install minikube
```
If `which minikube` fails after installation via brew, you may have to remove the minikube cask and link the binary:
```
brew cask remove minikube
brew link minikube
```
Otherwise, download minikube directly:
```shell
......
......@@ -11,39 +11,43 @@ date: 2019-11-24
## Prerequisites
- minikube 1.9.0 or higher
- minikube 1.10.1 or higher
- kubectl
## Tutorial
- Start a cluster with 2 nodes in the driver of your choice (the extra parameters are to make our chosen CNI, flannel, work while we're still experimental):
- Start a cluster with 2 nodes in the driver of your choice:
```
minikube start --nodes 2 -p multinode-demo --network-plugin=cni --extra-config=kubeadm.pod-network-cidr=10.244.0.0/16
😄 [multinode-demo] minikube v1.9.2 on Darwin 10.14.6
minikube start --nodes 2 -p multinode-demo
😄 [multinode-demo] minikube v1.10.1 on Darwin 10.15.4
✨ Automatically selected the hyperkit driver
👍 Starting control plane node multinode-demo in cluster multinode-demo
🔥 Creating hyperkit VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...
🐳 Preparing Kubernetes v1.18.0 on Docker 19.03.8 ...
▪ kubeadm.pod-network-cidr=10.244.0.0/16
🌟 Enabling addons: default-storageclass, storage-provisioner
🔥 Creating hyperkit VM (CPUs=2, Memory=2200MB, Disk=20000MB) ...
🐳 Preparing Kubernetes v1.18.2 on Docker 19.03.8 ...
🔎 Verifying Kubernetes components...
🌟 Enabled addons: default-storageclass, storage-provisioner
❗ Multi-node clusters are currently experimental and might exhibit unintended behavior.
To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.
👍 Starting node multinode-demo-m02 in cluster multinode-demo
🔥 Creating hyperkit VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...
🔥 Creating hyperkit VM (CPUs=2, Memory=2200MB, Disk=20000MB) ...
🌐 Found network options:
▪ NO_PROXY=192.168.64.213
🐳 Preparing Kubernetes v1.18.0 on Docker 19.03.8 ...
▪ NO_PROXY=192.168.64.11
🐳 Preparing Kubernetes v1.18.2 on Docker 19.03.8 ...
🏄 Done! kubectl is now configured to use "multinode-demo"
```
- Get the list of your nodes:
```
kubectl get nodes
NAME STATUS ROLES AGE VERSION
multinode-demo Ready master 9m58s v1.18.0
multinode-demo-m02 Ready <none> 9m5s v1.18.0
NAME STATUS ROLES AGE VERSION
multinode-demo Ready master 72s v1.18.2
multinode-demo-m02 Ready <none> 33s v1.18.2
```
NOTE: You can also check the status of your nodes:
- You can also check the status of your nodes:
```
$ minikube status
multinode-demo
......@@ -59,22 +63,6 @@ host: Running
kubelet: Running
```
- Install a CNI (e.g. flannel):
NOTE: This currently needs to be done manually after the apiserver is running, the multi-node feature is still experimental as of 1.9.2.
```
kubectl apply -f kube-flannel.yaml
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds-amd64 created
daemonset.apps/kube-flannel-ds-arm64 created
daemonset.apps/kube-flannel-ds-arm created
daemonset.apps/kube-flannel-ds-ppc64le created
daemonset.apps/kube-flannel-ds-s390x created
```
- Deploy our hello world deployment:
```
kubectl apply -f hello-deployment.yaml
......@@ -86,7 +74,6 @@ deployment "hello" successfully rolled out
- Deploy our hello world service, which just spits back the IP address the request was served from:
{{% readfile file="/docs/tutorials/includes/hello-svc.yaml" %}}
```
kubectl apply -f hello-svc.yml
service/hello created
......@@ -133,11 +120,6 @@ Hello from hello-c7b8df44f-xv4v6 (10.244.0.2)
- Referenced YAML files
{{% tabs %}}
{{% tab kube-flannel.yaml %}}
```
{{% readfile file="/docs/tutorials/includes/kube-flannel.yaml" %}}
```
{{% /tab %}}
{{% tab hello-deployment.yaml %}}
```
{{% readfile file="/docs/tutorials/includes/hello-deployment.yaml" %}}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册