I launched minikube with the docker driver on a remote machine and I have used a nodePort service for a particular pod. I believe nodePort exposes the port on the minikube docker container. On doing minikube IP it gave me the IP of the docker container in which minikube runs. How can I port map the port from the minnikube container to the host port so that I can access it remotely. A different approach would other than using driver=none or restarting minikube is appreciated as I do not want to restart my spinnaker cluster.
There is a minikube service <SERVICE_NAME> --url command which will give you a url where you can access the service. In order to open the exposed service, the minikube service <SERVICE_NAME> command can be used:
$ minikube service example-minikube
Opening kubernetes service default/hello-minikube in default browser...
This command will open the specified service in your default browser.
There is also a --url option for printing the url of the service which is what gets opened in the browser:
$ minikube service example-minikube --url
http://192.168.99.100:31167
You can run minikube service list to get list of all available services with their corresponding URL's. Also make sure the service points to correct pod by using correct selector.
Try also to execute command:
ssh -i ssh -i ~/.minikube/machines/minikube/id_rsa docker#$(minikube ip) -L *:30000:0.0.0.0:30000
Take a look: minikube-service-port-forward, expose-port-minikube, minikube-service-documentation.
Related
I'm working with minikube and docker (hyper-v), and
I'm trying to expose a service with the command:
minikube service
But when I try to open the web page I obtain the following return:
ERR_CONNECTION_RESET
I link the screenshot of the launched command
I use docker desktop and minikube on Windows 10. I found the ip address of local docker repository with minikube docker-env command like below,
> minikube docker-env
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://172.17.105.232:2376
SET DOCKER_CERT_PATH=C:\Users\joseph\.minikube\certs
SET MINIKUBE_ACTIVE_DOCKERD=minikube
REM To point your shell to minikube's docker-daemon, run:
REM #FOR /f "tokens=*" %i IN ('minikube -p minikube docker-env') DO #%i
And I set the ip address of docker daemon with above DOCKER_HOST value, not localhost and I can use locally built docker images without errors. But in the case of minikube dashboard, the ip address is always localhost(127.0.0.1) when I type minikube dashboard command. So I can not generate kubernetes namespace and persistent volume. It throws error
the server could not find the requested resource
I think this issue is the matter of authorization with different ip addresses. How to configure the static or specific ip address and port number on minukube dashboard so I can generate namespace and persistent volumes without such errors on minikube dashboard?
If I understand correctly you are trying to access kubernetes dashboard from remote host.
When running minikube dashboard, minikube binary runs kubectl proxy command under the hood.
By default running kubectl proxy binds to loopback interface of your local machine, therefore it can't be accessed from outside.
You can't change minikube cli bahaviour (without changing source code) but what you can do is to note down path to a dashboard:
/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
and run kubectl proxy by your self adding --address paramater with 0.0.0.0 value.
So now running this you will see:
$ kubectl proxy --address 0.0.0.0
Starting to serve on [::]:8001
Now open a browser on your remote host and go to:
<your-host-external-ip>:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
That's it. Let me know if it helped.
Unable to login in iscsi initiator in docker container running inside a kubernetes cluster
I have installed open-iscsi package in a docker ubuntu container with privileged mode inside a kubeminion. The iscsi target is running and the iscsi initiator discovery returns the correct initiator name iqn. When I try to login, I get this:
ERROR :
iscsiadm: got read error (0/111), daemon died? iscsiadm: Could not
login to [iface: default, target: iqn.2016-09.com.abcdefg.xyza:name,
portal: 10.102.83.21,3260]. iscsiadm: initiator reported error (18 -
could not communicate to iscsid) iscsiadm: Could not log into all
portals
I tried service iscsid restart and debug with iscsid -d 8 -f command, still login is not successful
Adding --net=host flag and --privileged flag while docker run within the cluster, both iscsi discover and login will be successful. iscsi expects host's networking services to run with privileged access. The command should be,
docker run -it --privileged --net=host name:tag
With the network set to host a container will share the host’s network stack and all interfaces from the host will be available to the container. The container’s hostname will match the hostname on the host system.
For more details, refer the documentation :
https://docs.docker.com/engine/reference/run/#network-settings
Note:Flag --net works on older and latest versions of docker, --network works on latest docker version only.
I have a docker image (usermanagement:latest) from which I normally create containers this way when I'm testing locally:
docker run --net "host" -p 8096:8096 -v $(pwd):/etc usermanagement:latest -port 8096 -configfile /etc/config
Both port and configfile has default values and port's default value is 8096.
I can then simply reach it at localhost:8096/1/users/some_api. This gives me the flexibility of being able to create many containers of the same image listening to different ports.
Now, I've pushed this image into a private registry and want to use minikube which also has access to the registry (all good and fine).
Problem is I can't figure out how to specify networking options (--net or -p) or even volume option (-v) when creating a Kubernetes deployment.
I tried:
kubectl run usr --image=$REGISTRY_IP:80/usermanagement:latest --port=8096
kubectl expose deployment usr --target-port=8096 --type=NodePort
Where REGISTRY_IP is the IP of the private registry from which the image has already been pulled into the minikube's docker.
I've verified the service is created and exposed, but I can't reach (getting 404) the container in minikube using:
curl -v http://192.168.42.149:31900/1/users/some_api
Service's IP and port above came from:
kubectl get svc usr
minikube ip
Any help is appreciated.
From this article it was really easy to "docker-machine create" a VM host on google compute engine. My problem is that when using the ip(docker-machine NameOfVM) to access a running nginx container it does not responde.
I can see that nginx is running, when I SSH into the VM and run "curl localhost".
I can ping the VM but curl or browser is not responding.
Do you know what I am missing?
ifconfig shows a docker0 adapter and a eth0.
Do I have to configure docker any further? As I understand, docker is not running any boot2docker/VM's on a linux machine?
Thanks
You may read firewall section of the Google Compute Engine docs to configure your firewall:
You can also create a firewall rule that allows HTTP traffic from anywhere to all instances on the example-network network. Execute the following:
$ gcloud compute firewall-rules create web --network example-network --allow tcp:80`