Last active
March 26, 2019 14:01
-
-
Save bharrisau/7de21d5a23ae2d3b15172c0ba7d10469 to your computer and use it in GitHub Desktop.
RancherOS on KVM and ZFS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zfs create poolname/images/rancher | |
zfs set recordsize=16K poolname/images/rancher | |
zfs set compression=lz4 poolname/images/rancher | |
qemu-img create -f qcow2 -ocluster_size=16K /poolname/images/rancher/rancher.qcow2 16G | |
mkdir -p /images/rancher/images/pxeboot | |
mkdir -p /images/rancher/config/openstack/latest/ | |
wget https://releases.rancher.com/os/latest/vmlinuz -O /images/rancher/images/pxeboot/vmlinuz | |
wget https://releases.rancher.com/os/latest/initrd -O /images/rancher/images/pxeboot/initrd.img | |
vim /images/rancher/config/openstack/latest/user_data | |
virt-install --name rancher --memory 8192 --vcpus 2 --cpu host --os-type linux --os-variant rhel7 \ | |
--network bridge=br0 --graphics none --noautoconsole --accelerate \ | |
--disk /images/rancher/rancher.qcow2,cache=writeback,device=disk,bus=virtio \ | |
--filesystem /images/rancher/config/,config-2,mode=squash \ | |
--location /images/rancher/ --extra-args="rancher.state.dev=LABEL=RANCHER_STATE rancher.state.autoformat=[/dev/sda,/dev/vda] console=ttyS0,115200n8 rancher.autologin=ttyS0 rancher.cloud_init.datasources=['configdrive']" \ | |
--boot hd | |
virsh console rancher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
ssh_authorized_keys: | |
- ssh-ed25519 .... | |
rancher: | |
network: | |
interfaces: | |
eth0: | |
address: IPADDR/32 | |
mtu: 1500 | |
dhcp: false | |
pre_up: | |
- ip link set eth0 address MAC | |
post_up: | |
- route add GW dev eth0 | |
- route add default gw GW4 | |
ssh: | |
port: 10022 | |
services: | |
rancher-agent1: | |
image: rancher/rancher-agent:v2.1.7 | |
command: --server https://host.tld --token XXXXXXXXXX --node-name YYYYYY --address xxx.xxx.xxx.xxx --etcd --controlplane --worker | |
privileged: true | |
restart: unless-stopped | |
net: host | |
volumes: | |
- /var/run:/var/run | |
- /etc/kubernetes:/etc/kubernetes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is running on OVH under KVM using a fallback IP address with virtual MAC set. The host also needs a static route set on the bridge to the vm.