Merge branch 'master' into gomods
commit
313cf575fe
|
@ -27,6 +27,7 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/cluster"
|
||||
pkg_config "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/console"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/exit"
|
||||
"k8s.io/minikube/pkg/minikube/machine"
|
||||
pkgutil "k8s.io/minikube/pkg/util"
|
||||
|
@ -69,6 +70,12 @@ itself, leaving all files intact. The cluster can be started again with the "sta
|
|||
if err := cmdUtil.KillMountProcess(); err != nil {
|
||||
console.OutStyle("warning", "Unable to kill mount process: %s", err)
|
||||
}
|
||||
|
||||
machineName := pkg_config.GetMachineName()
|
||||
err = pkgutil.UnsetCurrentContext(constants.KubeconfigPath, machineName)
|
||||
if err != nil {
|
||||
exit.WithError("update config", err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Using Minikube with an HTTP Proxy
|
||||
# minikube: Using HTTP/HTTPS proxies
|
||||
|
||||
minikube requires access to the internet via HTTP, HTTPS, and DNS protocols. If a HTTP proxy is required to access the internet, you may need to pass the proxy connection information to both minikube and Docker using environment variables:
|
||||
|
||||
|
@ -23,8 +23,7 @@ export HTTP_PROXY=http://<proxy hostname:port>
|
|||
export HTTPS_PROXY=https://<proxy hostname:port>
|
||||
export NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24
|
||||
|
||||
minikube start --docker-env=HTTP_PROXY=$HTTP_PROXY --docker-env HTTPS_PROXY=$HTTPS_PROXY \
|
||||
--docker-env NO_PROXY=$NO_PROXY
|
||||
minikube start
|
||||
```
|
||||
|
||||
To make the exported variables permanent, consider adding the declarations to ~/.bashrc or wherever your user-set environment variables are stored.
|
||||
|
@ -36,12 +35,23 @@ set HTTP_PROXY=http://<proxy hostname:port>
|
|||
set HTTPS_PROXY=https://<proxy hostname:port>
|
||||
set NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.1/24,192.168.39.0/24
|
||||
|
||||
minikube start --docker-env=HTTP_PROXY=$HTTP_PROXY --docker-env HTTPS_PROXY=$HTTPS_PROXY \
|
||||
--docker-env NO_PROXY=$NO_PROXY
|
||||
minikube start
|
||||
```
|
||||
|
||||
To set these environment variables permanently, consider adding these to your [system settings](https://support.microsoft.com/en-au/help/310519/how-to-manage-environment-variables-in-windows-xp) or using [setx](https://stackoverflow.com/questions/5898131/set-a-persistent-environment-variable-from-cmd-exe)
|
||||
|
||||
## Configuring Docker to use a proxy
|
||||
|
||||
As of v1.0, minikube automatically configures the Docker instance inside of the VM to use the proxy environment variables, unless you have specified a `--docker-env` override. If you need to manually configure Docker for a set of proxies, use:
|
||||
|
||||
|
||||
```shell
|
||||
minikube start \
|
||||
--docker-env=HTTP_PROXY=$HTTP_PROXY \
|
||||
--docker-env HTTPS_PROXY=$HTTPS_PROXY \
|
||||
--docker-env NO_PROXY=$NO_PROXY
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### unable to cache ISO... connection refused
|
||||
|
@ -84,6 +94,10 @@ Ask your IT department for the appropriate PEM file, and add it to:
|
|||
|
||||
Then run `minikube delete` and `minikube start`.
|
||||
|
||||
## downloading binaries: proxyconnect tcp: tls: oversized record received with length 20527
|
||||
|
||||
Your need to set a correct `HTTPS_PROXY` value.
|
||||
|
||||
## Additional Information
|
||||
|
||||
* [Configure Docker to use a proxy server](https://docs.docker.com/network/proxy/)
|
||||
|
|
|
@ -96,6 +96,7 @@ Some environment variables may be useful for using the `none` driver:
|
|||
|
||||
## Known Issues
|
||||
|
||||
* `systemctl` is required. [#2704](https://github.com/kubernetes/minikube/issues/2704)
|
||||
* `-p` (profiles) are unsupported: It is not possible to run more than one `--vm-driver=none` instance
|
||||
* Many `minikube` commands are not supported, such as: `dashboard`, `mount`, `ssh`
|
||||
* minikube with the `none` driver has a confusing permissions model, as some commands need to be run as root ("start"), and others by a regular user ("dashboard")
|
||||
|
|
|
@ -312,3 +312,16 @@ func GetPortFromKubeConfig(filename, machineName string) (int, error) {
|
|||
port, err := strconv.Atoi(kport)
|
||||
return port, err
|
||||
}
|
||||
|
||||
//UnsetCurrentContext unsets the current-context from minikube to "" on minikube stop
|
||||
func UnsetCurrentContext(filename, machineName string) error {
|
||||
confg, err := ReadConfigOrNew(filename)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Error getting kubeconfig status")
|
||||
}
|
||||
confg.CurrentContext = ""
|
||||
if err := WriteConfig(confg, filename); err != nil {
|
||||
return errors.Wrap(err, "writing kubeconfig")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -77,6 +77,16 @@ func TestStartStop(t *testing.T) {
|
|||
t.Fatalf("IP command returned an invalid address: %s", ip)
|
||||
}
|
||||
|
||||
// check for the current-context before and after the stop
|
||||
kubectlRunner := util.NewKubectlRunner(t)
|
||||
currentContext, err := kubectlRunner.RunCommand([]string{"config", "current-context"})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to fetch current-context")
|
||||
}
|
||||
if strings.TrimRight(string(currentContext), "\n") != "minikube" {
|
||||
t.Fatalf("got current-context - %q, want current-context %q", string(currentContext), "minikube")
|
||||
}
|
||||
|
||||
checkStop := func() error {
|
||||
r.RunCommand("stop", true)
|
||||
return r.CheckStatusNoFail(state.Stopped.String())
|
||||
|
@ -86,6 +96,11 @@ func TestStartStop(t *testing.T) {
|
|||
t.Fatalf("timed out while checking stopped status: %v", err)
|
||||
}
|
||||
|
||||
// running this command results in error when the current-context is not set
|
||||
if err := r.Run("config current-context"); err != nil {
|
||||
t.Logf("current-context is not set to minikube")
|
||||
}
|
||||
|
||||
r.Start(test.args...)
|
||||
r.CheckStatus(state.Running.String())
|
||||
|
||||
|
|
Loading…
Reference in New Issue