From 8d3c1306b354d63ec04f6372580afbeca147fe9a Mon Sep 17 00:00:00 2001 From: Guo Ruijing Date: Sat, 16 Feb 2019 00:16:49 -0500 Subject: enable virtlet & kata Change-Id: I88f7b579a825ba7ad25da5074773e5668f0ef000 Signed-off-by: Guo Ruijing --- src/vagrant/kubeadm/Vagrantfile | 2 +- src/vagrant/kubeadm/deploy.sh | 4 +- src/vagrant/kubeadm/virtlet/cirros-vm.yaml | 42 +++ src/vagrant/kubeadm/virtlet/images.yaml | 3 + src/vagrant/kubeadm/virtlet/virtlet-ds.yaml | 521 +++++++++++++++++++++++++++ src/vagrant/kubeadm/virtlet/virtlet.sh | 21 ++ src/vagrant/kubeadm/virtlet/virtlet_setup.sh | 10 + src/vagrant/kubeadm/worker_setup.sh | 1 + 8 files changed, 601 insertions(+), 3 deletions(-) create mode 100644 src/vagrant/kubeadm/virtlet/cirros-vm.yaml create mode 100644 src/vagrant/kubeadm/virtlet/images.yaml create mode 100644 src/vagrant/kubeadm/virtlet/virtlet-ds.yaml create mode 100755 src/vagrant/kubeadm/virtlet/virtlet.sh create mode 100644 src/vagrant/kubeadm/virtlet/virtlet_setup.sh (limited to 'src/vagrant/kubeadm') diff --git a/src/vagrant/kubeadm/Vagrantfile b/src/vagrant/kubeadm/Vagrantfile index e861859..dc5efb1 100644 --- a/src/vagrant/kubeadm/Vagrantfile +++ b/src/vagrant/kubeadm/Vagrantfile @@ -11,7 +11,7 @@ Vagrant.configure("2") do |config| config.vm.define "registry" do |config| config.vm.hostname = "registry" - config.vm.provision "shell", path: "registry_setup.sh", privileged: false + #config.vm.provision "shell", path: "registry_setup.sh", privileged: false config.vm.network :private_network, ip: "192.168.1.5" end diff --git a/src/vagrant/kubeadm/deploy.sh b/src/vagrant/kubeadm/deploy.sh index 0154031..82b2483 100755 --- a/src/vagrant/kubeadm/deploy.sh +++ b/src/vagrant/kubeadm/deploy.sh @@ -6,6 +6,6 @@ DIR="$(dirname `readlink -f $0`)" cd $DIR ../cleanup.sh vagrant up -vagrant ssh master -c "/vagrant/istio/istio.sh" -vagrant ssh master -c "/vagrant/multus/multus.sh" vagrant ssh master -c "/vagrant/kata/nginx-app.sh" +vagrant ssh master -c "/vagrant/virtlet/virtlet.sh" +vagrant ssh master -c "/vagrant/istio/istio.sh" diff --git a/src/vagrant/kubeadm/virtlet/cirros-vm.yaml b/src/vagrant/kubeadm/virtlet/cirros-vm.yaml new file mode 100644 index 0000000..334142b --- /dev/null +++ b/src/vagrant/kubeadm/virtlet/cirros-vm.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: Pod +metadata: + name: cirros-vm + annotations: + # This tells CRI Proxy that this pod belongs to Virtlet runtime + kubernetes.io/target-runtime: virtlet.cloud + # CirrOS doesn't load nocloud data from SCSI CD-ROM for some reason + VirtletDiskDriver: virtio + # inject ssh keys via cloud-init + VirtletSSHKeys: | + ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCaJEcFDXEK2ZbX0ZLS1EIYFZRbDAcRfuVjpstSc0De8+sV1aiu+dePxdkuDRwqFtCyk6dEZkssjOkBXtri00MECLkir6FcH3kKOJtbJ6vy3uaJc9w1ERo+wyl6SkAh/+JTJkp7QRXj8oylW5E20LsbnA/dIwWzAF51PPwF7A7FtNg9DnwPqMkxFo1Th/buOMKbP5ZA1mmNNtmzbMpMfJATvVyiv3ccsSJKOiyQr6UG+j7sc/7jMVz5Xk34Vd0l8GwcB0334MchHckmqDB142h/NCWTr8oLakDNvkfC1YneAfAO41hDkUbxPtVBG5M/o7P4fxoqiHEX+ZLfRxDtHB53 me@localhost + # set root volume size + VirtletRootVolumeSize: 1Gi +spec: + # This nodeAffinity specification tells Kubernetes to run this + # pod only on the nodes that have extraRuntime=virtlet label. + # This label is used by Virtlet DaemonSet to select nodes + # that must have Virtlet runtime + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: extraRuntime + operator: In + values: + - virtlet + containers: + - name: cirros-vm + # This specifies the image to use. + # virtlet.cloud/ prefix is used by CRI proxy, the remaining part + # of the image name is prepended with https:// and used to download the image + image: virtlet.cloud/cirros + imagePullPolicy: IfNotPresent + # tty and stdin required for `kubectl attach -t` to work + tty: true + stdin: true + resources: + limits: + # This memory limit is applied to the libvirt domain definition + memory: 160Mi diff --git a/src/vagrant/kubeadm/virtlet/images.yaml b/src/vagrant/kubeadm/virtlet/images.yaml new file mode 100644 index 0000000..1541ca7 --- /dev/null +++ b/src/vagrant/kubeadm/virtlet/images.yaml @@ -0,0 +1,3 @@ +translations: + - name: cirros + url: https://github.com/mirantis/virtlet/releases/download/v0.9.3/cirros.img diff --git a/src/vagrant/kubeadm/virtlet/virtlet-ds.yaml b/src/vagrant/kubeadm/virtlet/virtlet-ds.yaml new file mode 100644 index 0000000..1bb4882 --- /dev/null +++ b/src/vagrant/kubeadm/virtlet/virtlet-ds.yaml @@ -0,0 +1,521 @@ +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + creationTimestamp: null + name: virtlet + namespace: kube-system +spec: + selector: + matchLabels: + runtime: virtlet + template: + metadata: + creationTimestamp: null + labels: + runtime: virtlet + name: virtlet + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: extraRuntime + operator: In + values: + - virtlet + containers: + - command: + - /libvirt.sh + image: mirantis/virtlet:v1.4.1 + imagePullPolicy: IfNotPresent + name: libvirt + readinessProbe: + exec: + command: + - /bin/sh + - -c + - socat - UNIX:/var/run/libvirt/libvirt-sock-ro