k3s/cluster/cloudimages/k8s-ebs-jessie-amd64-hvm.yml

102 lines
3.7 KiB
YAML

---
name: k8s-1.2-debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: hvm
enhanced_networking: simple
description: Kubernetes 1.2 Base Image - Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
# tarball speeds up development, but for prod builds we want to be 100% sure...
# tarball: true
system:
release: jessie
architecture: amd64
# We use grub, not extlinux.
# See https://github.com/andsens/bootstrap-vz/issues/182
# extlinux makes it harder to modify boot args, and may have reboot problems
# bootloader: extlinux
bootloader: grub
charmap: UTF-8
locale: en_US
timezone: UTC
volume:
backing: ebs
partitions:
type: msdos
root:
filesystem: ext4
size: 8GiB
packages:
mirror: http://cloudfront.debian.net/debian
install:
# these packages are included in the official image
- python-boto
- python3-boto
- apt-transport-https
- lvm2
- ncurses-term
- parted
- bootlogd
- cloud-init
- cloud-utils
- gdisk
- sysvinit
- systemd
- systemd-sysv
# these packages are included in the official image, but we remove them
# awscli : we install from pip instead
# cloud-initramfs-growroot will resize the master partition on boot
- cloud-initramfs-growroot
# These packages would otherwise be installed during first boot
- aufs-tools
- curl
- python-yaml
- git
- nfs-common
- bridge-utils
- logrotate
- socat
- python-apt
- apt-transport-https
- unattended-upgrades
- lvm2
- btrfs-tools
# So we can install the latest awscli
- python-pip
plugins:
cloud_init:
metadata_sources: Ec2
username: admin
ntp: {}
commands:
commands:
# Install python-pip
- [ 'chroot', '{root}', 'pip', 'install', 'awscli' ]
# Install docker 1.9.1
- [ 'wget', 'http://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_1.9.1-0~jessie_amd64.deb', '-O', '{root}/tmp/docker.deb' ]
- [ '/bin/sh', '-c', 'cd {root}/tmp; echo "c58c39008fd6399177f6b2491222e4438f518d78 docker.deb" | shasum -c -' ]
- [ 'chroot', '{root}', '/bin/sh', '-c', 'DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes libapparmor1' ]
- [ 'chroot', '{root}', '/bin/sh', '-c', 'DEBIAN_FRONTEND=noninteractive dpkg --install /tmp/docker.deb' ]
- [ 'rm', '{root}/tmp/docker.deb' ]
# Fix a cloud-init bug where it uses nobootwait
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=789884
- [ 'chroot', '{root}', '/bin/sh', '-c', 'echo "mount_default_fields: [~, ~, ''auto'', ''defaults,nofail'', ''0'', ''2'']" > /etc/cloud/cloud.cfg.d/99_kubernetes.cfg' ]
# We perform a full replacement of some grub conf variables:
# GRUB_CMDLINE_LINUX_DEFAULT (add memory cgroup)
# GRUB_TIMEOUT (remove boot delay)
# (but leave the old versions commented out for people to see)
- [ 'chroot', '{root}', 'touch', '/etc/default/grub' ]
- [ 'chroot', '{root}', 'sed', '-i', 's/^GRUB_CMDLINE_LINUX_DEFAULT=/#GRUB_CMDLINE_LINUX_DEFAULT=/g', '/etc/default/grub' ]
- [ 'chroot', '{root}', 'sed', '-i', 's/^GRUB_TIMEOUT=/#GRUB_TIMEOUT=/g', '/etc/default/grub' ]
- [ 'chroot', '{root}', '/bin/sh', '-c', 'echo "# kubernetes image changes" >> /etc/default/grub' ]
- [ 'chroot', '{root}', '/bin/sh', '-c', 'echo "GRUB_CMDLINE_LINUX_DEFAULT=\"cgroup_enable=memory oops=panic panic=10 console=ttyS0\"" >> /etc/default/grub' ]
- [ 'chroot', '{root}', '/bin/sh', '-c', 'echo "GRUB_TIMEOUT=0" >> /etc/default/grub' ]
- [ 'chroot', '{root}', 'update-grub2' ]