PC based multiple VM & docker containers with Kubernetes - going beyond minikube

7/28/2017

Would like run a cluster of containers, distributed between 2 VMs, both running on same host (my PC, running Windows 7 Pro, 64-bit), managed in turn by Kubernetes. The containers must exchange messages over network, between themselves, and also applications like 'Request generator' and 'Response generator', running natively on same host or even other host.

Now Minikube is configured with only 1 node (VM). Anything else that can be done to enable at least 2 VMs ?

Here is what I want to achieve:

-- icarus74
docker
kubernetes
minikube

2 Answers

4/4/2020

You could use multipass to create a k3s cluster:

# Install multipass
sudo snap install multipass --classic

# Delete vms if they exists
multipass delete master
multipass delete node1
multipass delete node2
multipass purge 

# Launch nodes
multipass launch -n master & multipass launch -n node1 & multipass launch -n node2

# Download, transfer and run master install script
curl -sfL https://get.k3s.io > k3s.sh
multipass transfer k3s.sh master:
multipass exec master bash k3s.sh

# Get k8s joining token from master
multipass exec master sudo cat /var/lib/rancher/k3s/server/node-token > token

# Get master ip
multipass ls | grep master | awk '{print $3}' > masterip

# Create script to join to master node
echo 'curl -sfL https://get.k3s.io | K3S_URL=https://'$(cat masterip):6443' K3S_TOKEN='$(cat token) sh - > node_join.sh

# Trasnfer scripts to node vms
multipass transfer node_join.sh node1: 
multipass transfer node_join.sh node2:

# Run script on node vms
multipass exec node1 bash node_join.sh & multipass exec node2 bash node_join.sh

# Get kubectl configuration file
multipass exec master sudo cat /etc/rancher/k3s/k3s.yaml > k3s.yaml
# Use ip of master in config
cat k3s.yaml | sed "s/127.0.0.1/$(cat masterip)/" >> k3s.yaml

# Confirm that we can see nodes
kubectl get nodes --kubeconfig k3s.yaml 
-- Harry
Source: StackOverflow

7/28/2017

I didn’t see the option to create two VM in minikube. But you can use VirtualBox and create two VMs with Linux OS then create the kubernets cluster.

I used centos 7 for this setup. Here are the few steps you can.

  1. When you create the VM select the bridged network option.
  2. select the static IP
  3. Use kubeadm to configure the cluster.
  4. Here is the steps for kubeadm. https://kubernetes.io/docs/setup/independent/install-kubeadm/
-- sfgroups
Source: StackOverflow