Cannot open minikube dashboard from the VM on my local machine - kubernetes

I have installed minikube on my linux server on my Oracle VM. I have tried opening the dashboard, but I can't open it open on my local machine.
The process I follow:
minikube start
minikube dashboard
Enabling dashboard ...
Verifying dashboard health ...
Launching proxy ...
Verifying proxy health ...
After this, it gives me a url (http://127.0.0.1:44987/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:proxy/ )
When I tried opening this mentioned url manually on my local machine (Chrome or Firefox) it doesn't open.
Operating System : Windows
Driver: Docker

If you can curl http://127.0.0.1:44987 from the VM, then you need to open the (random?) port-forwarded address on your VM software (or Oracle Cloud?)
In other words, by default, the printed address is local to that Linux machine, not to your Windows host, and minikube doesn't know its running in a VM under Windows.

Related

How to add hosts to AWX?

I have a VirtualBox Desktop Ubuntu machine with AWX running. I then spun up a separate server Ubuntu machine in VirtualBox. To act as one of my hosts. I took the IP address of the server Ubuntu machine and inputted it as a host in AWX.
After running a playbook I get the error "unreachable."
I did create a credential according to this: https://docs.ansible.com/ansible-tower/latest/html/userguide/credentials.html#machine. And received the same error.
I am looking use AWX to run playbooks on several on-prem Linux boxes/hosts. I am unsure how to configure AWS correctly credentials.

How to set minikube proxy when the driver is hyperkit or virtualbox?

I am trying to use Ingress in minikube by minikube addons enable ingress. However, currently Ingress cannot be used with minikube when the driver is docker on macOS based on this issue ticket.
So I turn to use hyperkit or virtualbox as driver. One image that need to be pulled when enabling Ingress is k8s.gcr.io/ingress-nginx/controller:v0.44.0. However, k8s.gcr.io is blocked in my current location.
So I try to use a VPN in global mode for my computer. However, I met this issue that hyperkit is unable to access k8s.gcr.io when the VPN is in use.
Then I found this document
https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/
My VPN is listening at 127.0.0.1:1087, I set
export HTTP_PROXY=http://127.0.0.1:1087
export HTTPS_PROXY=https://127.0.0.1:1087
export NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24
Then I tried all these methods to start minikube:
minikube start --driver=hyperkit
minikube start --driver=virtualbox
minikube start --driver=hyperkit --docker-env HTTP_PROXY=http://127.0.0.1:1087 --docker-env HTTPS_PROXY=https://127.0.0.1:1087 --docker-env NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24
But I saw these messages:
😄 minikube v1.21.0 on Darwin 11.2.3
✨ Using the hyperkit driver based on user configuration
❗ Local proxy ignored: not passing HTTP_PROXY=http://127.0.0.1:1087 to docker env.
❗ Local proxy ignored: not passing HTTPS_PROXY=https://127.0.0.1:1087 to docker env.
👍 Starting control plane node minikube in cluster minikube
🔥 Creating hyperkit VM (CPUs=2, Memory=6000MB, Disk=20000MB) ...
❗ Local proxy ignored: not passing HTTP_PROXY=http://127.0.0.1:1087 to docker env.
❗ Local proxy ignored: not passing HTTPS_PROXY=https://127.0.0.1:1087 to docker env.
and
😄 minikube v1.21.0 on Darwin 11.2.3
✨ Using the virtualbox driver based on existing profile
❗ Local proxy ignored: not passing HTTP_PROXY=http://127.0.0.1:1087 to docker env.
❗ Local proxy ignored: not passing HTTPS_PROXY=https://127.0.0.1:1087 to docker env.
Seems this "user configuration" overwrite my proxy config. But where is this "user configuration"?
What is the correct way to set proxy for minikube when the drive hyperkit or virtualbox? Thanks!
My guess is 127.0.0.1 conflicts with the VM's internal 127.0.0.1 address, and that's why it's ignored. You might need to configure your proxy to be your host's network IP instead of 127.0.0.1? You might not even need to configure a proxy? Also, the Virtualbox driver gives me problems with VPN. I have the best luck with the VMware driver, and can also get the HyperKit driver to work if I update the VM's DNS to my host's DNS.
minikube start --driver hyperkit
minikube ssh sudo resolvectl dns eth0 192.168.0.53
minikube ssh sudo resolvectl domain eth0 example.com
I also get the unable to access k8s.gcr.io error when creating the VM, but it doesn't seem to affect things.
Downloading this image using docker, exporting it to file, transfering it to minikube VM and importing it to local docker registry, like in this thread has solved the problem.
Your proxy is for circumventing the China Greate Firewall correct? Then I know why it is not working. It is not releated to hyperkit or virutalbox at all.
I checked the source code of minikube. "Local proxy ignored" actually means that your proxy url is set to localhost (127.0.*) and minikube thinks you set the proxy incorrectly so it will just ignore this setting.
The resolution is just to edit your host file (for Windows it is in C:\Windows\System32\drivers\etc\hosts), to give 127.0.0.1 a hostname. You can add the following line into the end of the host file.
127.0.0.1 localproxy
Then change environment variable http_proxy and https_proxy to http://localproxy:1235.
Reopen the CMD window to get the updated environment variable and restart the minikue. You should be able to find that the "Local proxy ignored" message is gone and finally you can download the image from gcr.io.

Exposing ingress to host windows machine when running minikube in vagrant virtualbox (ubuntu VM) with docker driver

I am running a vagrant box using virtual box (running headless ubuntu 18.04) on windows 10 host machine.
Inside the virtual box, I have minikube set up using docker as the vm-driver
minikube start --memory=6144 --cpus=2 --disk-size=40g --vm-driver=docker --bootstrapper kubeadm --kubernetes-version=1.17.4
My application is exposed via an ingress to the ubuntu machine running inside virtual box and I am able to access the application via wget/cURL
On running minikube IP it gave me the IP of the docker container in which minikube runs
Some additional configuration info -
Vagrant file -
I would like to access the application from my windows machine's browser , any idea how to achieve that ? vagrant port forwarding doesn't seem to help.
If you really want to use a setup like this(using vagrant etc.). You can just use --vm-driver=none and let the kubernetes run in your ubuntu box directly, this way you can leverage port-forwarding. You probably also can do it your way but I've never tried so I wouldn't know, but I know that none works. You can follow this guide.
There are different options like running minikube on windows directly. Which is perfectly fine as well.

VSCode devcontainer connect to kubernetes cluster on vm

Ultimate Goal
From a dotnet/core/sdk devcontainer (using VSCode Remote Containers), debug a .NET Core app running in a kubernetes cluster hosted on another vm of my host machine.
Current Setup
Docker Desktop for Windows running via Hyper-V
default DockerNAT network adapter
Ubuntu VM (multipass) running on same Hyper-V host
microk8s cluster running on this ubuntu instance
default "Default Switch" network adapter
Errors
When I try to ping the ubuntu vm from a docker container by hostname, the IP is resolved properly but I get the error "Destination Host Unreachable"
When I try to curl the cluster api, I get the error "No route to host"
I put this problem aside for a week, and over that time the host has been rebooted multiple times, but no further modifications were made to the networking, Hyper-V setup, etc.
Starting the Ubuntu VM today, the IP changed from what used to be 172.?.?.? to 192.168.92.x . I do not know what caused this change.
Now, Docker Desktop containers can ping the Ubuntu VM and curl the microk8s /api endpoint. Until such a time that I can reproduce the issue, I will mark this question as "solved" and reopen and try Nick's recommended solution if the issue returns.

Docker Tooling for Eclipse - how to connect to docker daemon running inside VM

I have a docker daemon/engine running inside guest (Ubuntu) virtual machine
and as per Docker Tooling for Eclipse instruction I had downloaded and setup the plugin in Eclipse Mars on my host Mac OS machine.
How do I connect to Docker running in guest VM from the host machine IDE.
As per instructions, I would need to enter TCP and authentication so how do I get these details to setup the connection?
I had tried with guest OS IP (i.e. tcp://127.0.0.1:2376 output of ifconfig command with local host IP) but was not able to connect.
Here are the steps I used to get Docker Tooling working in Eclipse Neon on Windows.
Open the Docker Quickstart Terminal
Execute docker-machine ls
Copy the URL (e.g. tcp://192.168.99.100:2376)
Click the Add Connection button in the toolbar for Docker Explorer
Provide a Connection name:
Select TCP Connection
Paste the above URL into the URI: edit box
Change tcp to https in the edit box
Select Enable authentication
Set the path to C:\Users\username\.docker\machine\certs
Click on Test Connection to verify
There are two parts to this. First, enabling the TCP socket (which I'll answer). Then, setting TLS authentication on the socket (which I'll link to but won't cover). The first part should get you up.
You'll need to edit the DOCKER_OPTS settings in /etc/default/docker in the VM. Edit this file and set DOCKER_OPTS to something like:
DOCKER_OPTS="-H tcp://0.0.0.0:2376 -H unix://"
Then, restart Docker (sudo service docker restart). This should get you a TCP connection that you can put in your Eclipse settings as:
tcp://10.0.2.15:2376
The second part (which is optional at this point) would be setting up the CA and certificates per https://docs.docker.com/engine/articles/https/. But I'd actually recommend just installing Docker Machine and provisioning your VM that way as it will create the needed certificates for you. Then, if your machine was named dev, you just point the authentication dir to ~/.docker/machine/machines/dev.
If Docker Daemon is running(i.e docker desktop running) in window task bar , not inside the VM , just get the URI from its context menu setting. In eclipse docker tooling perspective , we can connect to running docker daemon only by providing the URI.