项目作者: dotnwat

项目描述 :
Local multi-node kubernetes with Vagrant and libvirt
高级语言: Shell
项目地址: git://github.com/dotnwat/k8s-vagrant-libvirt.git
创建时间: 2019-03-21T00:34:00Z
项目社区:https://github.com/dotnwat/k8s-vagrant-libvirt

开源协议:

下载


k8s-vagrant-libvirt

A minimal setup for running multi-node kubernetes in vagrant virtual
machines using libvirt on linux.

Related projects:

Current supported configuration(s):

  • guest: centos 7
  • network: flannel

usage

Create and provision the cluster

  1. vagrant up --provider=libvirt

Set the kubectl configuration file

  1. vagrant ssh master -c "sudo cat /etc/kubernetes/admin.conf" > ${HOME}/.kube/config

Test cluster access from your host

  1. [~/src/k8s-vagrant-libvirt]$ kubectl get nodes
  2. NAME STATUS ROLES AGE VERSION
  3. master Ready master 30m v1.13.4
  4. worker0 Ready <none> 30m v1.13.4

configuration

The following options may be set in the Vagrantfile

  1. # number of worker nodes
  2. NUM_WORKERS = 1
  3. # number of extra disks per worker
  4. NUM_DISKS = 1
  5. # size of each disk in gigabytes
  6. DISK_GBS = 10

loading docker images

Use the vagrant-docker_load plugin to upload Docker images into Vagrant machines

  1. vagrant plugin install vagrant-docker_load

An example of loading a rook@master build

  1. [~/src/k8s-vagrant-libvirt]$ vagrant docker-load build-2568df12/ceph-amd64 rook/ceph:master
  2. Loaded image: build-2568df12/ceph-amd64:latest
  3. Loaded image: build-2568df12/ceph-amd64:latest

troubleshooting

The following is a summary of the environments and applications that are known to work

  1. [~/src/k8s-vagrant-libvirt]$ lsb_release -d
  2. Description: Fedora release 29 (Twenty Nine)
  3. [~/src/k8s-vagrant-libvirt]$ vagrant version
  4. Installed Version: 2.1.2
  5. [~/src/k8s-vagrant-libvirt]$ vagrant plugin list
  6. vagrant-libvirt (0.0.40, system)

Ceph distributed storage via Rook

  1. [~/src/k8s-vagrant-libvirt]$ kubectl -n rook-ceph-system logs rook-ceph-operator-b996864dd-l5czk | head -n 1
  2. 2019-03-21 16:09:18.168066 I | rookcmd: starting Rook v0.9.0-323.g2447520 with arguments '/usr/local/bin/rook ceph operator'
  3. [~/src/k8s-vagrant-libvirt]$ kubectl -n rook-ceph get pods
  4. NAME READY STATUS RESTARTS AGE
  5. rook-ceph-mgr-a-6b5cdfcb6f-hg7tr 1/1 Running 0 4m33s
  6. rook-ceph-mon-a-6cb6cfdb95-grgsz 1/1 Running 0 4m56s
  7. rook-ceph-mon-b-6477f5fc8c-m5mzg 1/1 Running 0 4m50s
  8. rook-ceph-mon-c-6cdf75fc4c-pgq5h 1/1 Running 0 4m42s
  9. rook-ceph-osd-0-8b5d9c477-5s989 1/1 Running 0 4m11s
  10. rook-ceph-osd-prepare-worker0-x5qqn 0/2 Completed 0 4m17s
  11. rook-ceph-tools-76c7d559b6-vcxhr 1/1 Running 0 3m48s