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

Unable to start minikube with --extra-config 'apiserver.cors-allowed-origins=["http://*"]' on mac #4477

Closed
jwausle opened this issue Jun 12, 2019 · 7 comments
Labels
cause/apiserver-flags Bad flags passed to apiserver co/kubeadm Issues relating to kubeadm kind/support Categorizes issue or PR as a support question.

Comments

@jwausle
Copy link

jwausle commented Jun 12, 2019

Complete cmd+output:

$ minikube --vm-driver=hyperkit --extra-config 'apiserver.cors-allowed-origins=["http://*"]' -v 10 start
* minikube v1.1.1 on darwin (amd64)
* Creating hyperkit VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
Found binary path at /usr/local/bin/docker-machine-driver-hyperkit
Launching plugin server for driver hyperkit
Plugin server listening at address 127.0.0.1:57386
...
* Configuring environment for Kubernetes v1.14.3 on Docker 18.09.6
Found binary path at /usr/local/bin/docker-machine-driver-hyperkit
Launching plugin server for driver hyperkit
Plugin server listening at address 127.0.0.1:57463
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minikube) Calling .GetSSHHostname
(minikube) Calling .GetSSHPort
(minikube) Calling .GetSSHKeyPath
(minikube) Calling .GetSSHUsername
  - apiserver.cors-allowed-origins=["http://*"]
(minikube) Calling .GetURL
* Pulling images ...
* Unable to pull images, which may be OK: running cmd: sudo kubeadm config images pull --config /var/lib/kubeadm.yaml: command failed: sudo kubeadm config images pull --config /var/lib/kubeadm.yaml
stdout:
stderr: error converting YAML to JSON: yaml: line 4: did not find expected key
: Process exited with status 1
* Launching Kubernetes ...

X Error starting cluster: cmd failed: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml  --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--data-minikube,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap
error converting YAML to JSON: yaml: line 4: did not find expected key

: Process exited with status 1

Output minikube logs:

minikube-logs.txt

The operating system version:

macos 10.14.5 (mojave)

@sharifelgamal sharifelgamal added the co/hyperkit Hyperkit related issues label Jun 13, 2019
@objectiveous
Copy link

I've seen similar issues.

minikube start --extra-config=apiserver.v=10 --vm-driver hyperkit --extra-config 'apiserver.cors-allowed-origins=["http://"]'  /default ⎈
😄 minikube v1.2.0 on darwin (amd64)
🔥 Creating hyperkit VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
🐳 Configuring environment for Kubernetes v1.15.0 on Docker 18.09.6
▪ apiserver.v=10
▪ apiserver.cors-allowed-origins=["http://
"]
🚜 Pulling images ...
❌ Unable to pull images, which may be OK: running cmd: sudo kubeadm config images pull --config /var/lib/kubeadm.yaml: command failed: sudo kubeadm config images pull --config /var/lib/kubeadm.yaml
stdout:
stderr: error converting YAML to JSON: yaml: line 4: did not find expected key
: Process exited with status 1
🚀 Launching Kubernetes ...

💣 Error starting cluster: cmd failed: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--data-minikube,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap
error converting YAML to JSON: yaml: line 4: did not find expected key

: Process exited with status 1

😿 Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
👉 https://github.com/kubernetes/minikube/issues/new

@tstromberg
Copy link
Contributor

I bet this issue is due to a lack of quoting when we generate the kubeadm YAML.

The fix is likely to be adding double quotes around {{$val}} for the different kubeadm templates, such as:

If you have a chance, give it a try and I'll be happy to review the PR. Help wanted!

@tstromberg tstromberg added cause/apiserver-flags Bad flags passed to apiserver co/kubeadm Issues relating to kubeadm help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed co/hyperkit Hyperkit related issues labels Jul 17, 2019
@objectiveous
Copy link

It was indeed an issue w/ quotes. The following worked:

minikube start --extra-config=apiserver.v=10 --vm-driver hyperkit --extra-config "apiserver.cors-allowed-origins=["http://localhost:3000"]"

Unfortunately, I'm unable to open a PR to fix this (long story).

@jwausle
Copy link
Author

jwausle commented Jul 19, 2019

One hint regarding http://* allowed redirections.

# The asterix '*' must escaped '\'on cmdline => 'http://\*'
minikube start \
   --vm-driver hyperkit \
   --extra-config "apiserver.cors-allowed-origins=["http://\*"]" 

@tstromberg

  • it's possible to start minikube from kubeadm-template?
  • it's possible to generate kubeadm-template from minikube command.

@tstromberg tstromberg added kind/support Categorizes issue or PR as a support question. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/backlog Higher priority than priority/awaiting-more-evidence. labels Sep 20, 2019
@tstromberg
Copy link
Contributor

Closing as a workaround appears to have been found.

@tstromberg
Copy link
Contributor

Related: #4806

@luchaoqi
Copy link

One hint regarding http://* allowed redirections.

# The asterix '*' must escaped '\'on cmdline => 'http://\*'
minikube start \
   --vm-driver hyperkit \
   --extra-config "apiserver.cors-allowed-origins=["http://\*"]" 

@tstromberg

  • it's possible to start minikube from kubeadm-template?
  • it's possible to generate kubeadm-template from minikube command.

Thanks for the hint. I have been searching for a solution to access the apiserver for days and it works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cause/apiserver-flags Bad flags passed to apiserver co/kubeadm Issues relating to kubeadm kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

5 participants