Skip to content

Latest commit

 

History

History
142 lines (96 loc) · 2.62 KB

README.md

File metadata and controls

142 lines (96 loc) · 2.62 KB

Installing Kubernetes locally in Hyper-V

Creating nodes

Required environment variables:

Variable Name Value
VAGRANT_EXPERIMENTAL typed_triggers
VAGRANT_SMB_USERNAME
VAGRANT_SMB_PASSWORD <Username> (e.g. HOME\misha)

If VAGRANT_EXPERIMENTAL is correctly set you will see the following at the start of Vagrant:

==> vagrant: You have requested to enabled the experimental flag with the following features:
==> vagrant:
==> vagrant: Features:  typed_triggers
==> vagrant:
==> vagrant: Please use with caution, as some of the features may not be fully
==> vagrant: functional yet.

Clean up nodes

vagrant destroy -f

Initializing Kubernetes nodes

vagrant up  --provider=hyperv

IMPORTANT: The last step of Windows worker configuration needs: to be done manually

Login into Windows VM and in elevated Powershell execute:

cd c:\vagrant\win-worker
.\start-k8s.ps1

If Vagrant is stuck creating windows node:

  • Ctrl-C

  • Kill ruby.exe

  • Re-provision node

    vagrant up  --provider=hyperv--provision win-worker-1

    Reprovisioning will reapply all provisioning steps for VM (node). All provisioning steps are idempotent.

Install networking using Flannel Gateway-Host mode

Flannel is installed in Gateway-Host mode:

networking\kube-flannel.yml:

  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "host-gw"
      }
    }

Flannel daemon sets will be patched to run on Linux only by nodes\master\node-selector-patch.yaml:

spec:
  template:
    spec:
      nodeSelector:
        beta.kubernetes.io/os: linux

Installation Results

  • Virtual Machines
Vagrant name VM name User Password
master k8s-master vagrant vagrant
worker-1 k8s-worker-1 vagrant vagrant
win-worker-1 k8s-win-worker-1 Vagrant vagrant
  • Cluster config file config
  • Cluster join instructions kubeadm-join
  • Cluster join script kubeadm-join.sh

Testing

Do Linux pods work?

Create Linux pod:

$env:KUBECONFIG="..."
kubectl apply -f 

Check that it is running:

kubectl get pods

Do Windows pods work?

Create Windows pod:

$env:KUBECONFIG="..."
kubectl apply -f 

Can Linux pods communicate with outside

kubectl get pods

Can Linux pods communicate with Windows pods

Can Windows pods communicate with outside

Can Windows pods communicate with Linux pods