Docker Swarm overlay network issue on Mac - macos

I have two physical machines both running in the same network, and I made one of them a manager and the other one worker. The nodes join correctly and I was able to view them by running docker node ls.
In the docker yml file, I have 4 applications in total which two on them running on the manager node and others running on the worker node.
My issue is that the applications in the manager node cannot reach the applications in the worker node via the overlay network.
More information:
The manager node is running Ubuntu 18.04 LTS, and the worker node is running on a Mac mini(macOS 10.14.1). The architecture looks like the below:
I suspect this is a Mac issue. Any ideas?

I have been trying to work around similar issues. The root cause is because Docker Desktop for MacOS is not a "true docker" and it does not forward network requests from/to other hosts properly. Details are here: https://docs.docker.com/docker-for-mac/docker-toolbox/
The work around is to use Virtual Machines in MacOS (e.g., VirtualBox) by docker-machine command lines. Details are introduced in How to connect to a docker container from outside the host (same network) [OSX 10.11]
I have tried the VirtualBox path, adding a third Network Adapter with bridged mode, and I can finally ping 3 nodes from the container.

Related

docker swarm manager on windows through a tailscale network

so I want my windows machine to be a manger node in my docker swarm. all the compute power will be on linux swarm nodes.
another complication, I am using tailscale for the network. I cant seem to configure docker to use the tailscale network for listen-addr and advertise-addr.
it seems to work ok if I dont try to force it to use tailscale.
any ides?
I have tried looking for a config json file to add a tailscale dns entry. but cant find it on windows

How to setup Kubernetes cluster on several windows hosts?

I have several Windows servers available and would like to setup a Kubernetes cluster on them.
Is there some tool or a step by step instruction how to do so?
What I tried so far is to install DockerDesktop and enable its Kubernetes feature.
That gives me a single node Cluster. However, adding additional nodes to that Docker-Kubernetes Cluster (from different Windows hosts) does not seem to be possible:
Docker desktop kubernetes add node
Should I first create a Docker Swarm and could then run Kubernetes on that Swarm? Or are there other strategies?
I guess that I need to open some ports in the Windows Firewall Settings of the hosts? And map those ports to some Docker containers in which Kubernetes is will be installed? What ports?
Is there some program that I could install on each Windows host and that would help me with setting up a network with multiple hosts and connecting the Kubernetes nodes running inside Docker containers? Like a "kubeadm for Windows"?
Would be great if you could give me some hint on the right direction.
Edit:
Related info about installing kubeadm inside Docker container:
https://github.com/kubernetes/kubernetes/issues/35712
https://github.com/kubernetes/kubeadm/issues/17
Related question about Minikube:
Adding nodes to a Windows Minikube Kubernetes Installation - How?
Info on kind (kubernetes in docker) multi-node cluster:
https://dotnetninja.net/2021/03/running-a-multi-node-kubernetes-cluster-on-windows-with-kind/
(Creates multi-node kubernetes cluster on single windows host)
Also see:
https://github.com/kubernetes-sigs/kind/issues/2652
https://hub.docker.com/r/kindest/node
You can always refer to the official kubernetes documentation which is the right source for the information.
This is the correct way to manage this question.
Based on Adding Windows nodes, you need to have two prerequisites:
Obtain a Windows Server 2019 license (or higher) in order to configure the Windows node that hosts Windows containers. If you are
using VXLAN/Overlay networking you must have also have KB4489899
installed.
A Linux-based Kubernetes kubeadm cluster in which you have access to the control plane (see Creating a single control-plane cluster with kubeadm).
Second point is especially important since all control plane components are supposed to be run on linux systems (I guess you can run a Linux VM on one of the servers to host a control plane components on it, but networking will be much more complicated).
And once you have a proper running control plane, there's a kubeadm for windows to proper join Windows nodes to the kubernetes cluster. As well as a documentation on how to upgrade windows nodes.
For firewall and which ports should be open check ports and protocols.
For worker node (which will be windows nodes):
Protocol Direction Port Range Purpose Used By
TCP Inbound 10250 Kubelet API Self, Control plane
TCP Inbound 30000-32767 NodePort Services All
Another option can be running windows nodes in cloud managed kuberneres, for example GKE with windows node pool (yes, I understand that it's not your use-case, but for further reference).

Kubernete NAT pod IP on Windows Nodes

I have a hybrid GKE Cluster running with some Linux and Windows nodes. I followed this how-to (https://cloud.google.com/kubernetes-engine/docs/how-to/ip-masquerade-agent) in order to configure the masquerade for some of my networks and it works like a charm on Linux Nodes. But it doesn't work on the windows hosts, it gives me this error:
Failed to create pod sandbox: rpc error: code = Unknown desc = failed to start sandbox container for pod "ip-masq-agent-pc9vn": Error response from daemon: network host not found
Anyone knows how can I configure masquerade on Windows Nodes?
Adding details:
I know that Linux containers don't run on Windows nodes, so ip-masq-agent won't run on that node and I know that I can use taints or labels to avoid the pods to be scheduled on that node.
I use Windows nodes with kubernetes because I have some .Net Framework applications running on it, and it works fine. My problem is that I need to masquerade the connections from the pod to hosts outside of the cluster because the source connections are the Pod IPs, not the node IP.
On Linux machines, I can do that using ip-masq-agent, that mange Iptables rules to masquerade the traffic. But on Windows, the ip-masq-agent doesn't work, for the reasons that #Rico said in his answer.
I want to know if someone knows another way to achieve the same thing on Windows nodes.
I can use a "NAT Machine" holding all connections in the middle and route all traffic to that machine, but it's a really ugly way to do that.
Solution:
I end up allowing the pod network to go through VPN. Thank you for all the replies.
The simple answer is you can't. iptables is a Linux thing. Windows has some alternatives that you can use to set up NAT (netsh) like described here: https://superuser.com/questions/1088309/windows-10-nat-port-forwarding-ip-masquerade, but there's no specific K8s support so you will be on your own.
To make sure your ip-masq-agent doesn't get scheduled on your Windows nodes you can follow a NodeSelector, Taint/Toleration approach as described here.
A wider question would be what are you trying to run on the Windows machines? Windows containers are not interchangeable with Linux containers. If you want your Linux pods and Windows pods to talk to each other have you tried Flannel?

Kubernetes (microk8s) vs Traditional Docker Host Machine Architecture

I tried to find the answer in previous post, but i did not find it !
My question seems dumb, i'm just trying to figure it out :)
I'm new to docker and kubernetes, i'm trying to understand the architecture of kubernetes cluster, nodes, and pods.
I'm using two machines with docker installed, each machine have two containers running, i want to install MicroK8s to start playing with kubernetes, my questions are :
As below image > Can I install it on separate machine and connect it to my docker host machines so it will manage my containers their with support of some sort of (agent/ maybe services) ?, Or kubernetes/MicroK8s must be installed on the machine that will host the containers ?
Can i add my running docker containers directly to a pod ? or i must re-create them ?
Many thanks
You can play with any VM software(cpu virtualization required).
You can set up 3 VMs(master, node1,node2). You have to install kubernetes in each VM. When you connect them thru calico they communicate each other. When you make pods with app or db , you can loadbalance to node1 and node2 or more from master. Then you can create a service to export route to the pods. Or If you want to run everything in one big server, you can. Horizontal scaling or vertical scaling is your choice.
you cant mount a running docker container to the pod but you can load a docker image from any registry.

Forwarding of Docker Container running GUI on a non-GUI host

I have a small cluster with docker nodes, I access it via a gateway server that I ssh into. What I would like to do, is to run e.g. Eclipse with a GUI on the cluster and access that GUI on my computer.
What I have found so far is this: http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
However, the problem I'm experiencing is that the host computer doesn't run any x-server, since it's only a node in a cluster, so I cannot mount the required directory into the container.
Is there a way to use GUI applications in a container with this setup?

Resources