From 91eb37093195b4ee0efc4bbfa4250a61e5027cd5 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Sat, 13 Feb 2016 16:35:05 -0500 Subject: [PATCH 1/6] AWS Debian: Only install linux-image-extra on Ubuntu It isn't available (and hopefully not needed) on Debian --- cluster/aws/templates/format-disks.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cluster/aws/templates/format-disks.sh b/cluster/aws/templates/format-disks.sh index 9aa04112a38..9afc1b93fd9 100644 --- a/cluster/aws/templates/format-disks.sh +++ b/cluster/aws/templates/format-disks.sh @@ -175,7 +175,9 @@ if [[ ${docker_storage} == "btrfs" ]]; then elif [[ ${docker_storage} == "aufs-nolvm" || ${docker_storage} == "aufs" ]]; then # Install aufs kernel module # Fix issue #14162 with extra-virtual - apt-get-install linux-image-extra-$(uname -r) linux-image-extra-virtual + if [[ `lsb_release -i -s` == 'Ubuntu' ]]; then + apt-get-install linux-image-extra-$(uname -r) linux-image-extra-virtual + fi # Install aufs tools apt-get-install aufs-tools From 977a4a56e47c762fc9926c69842502360b4810df Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Sat, 13 Feb 2016 19:50:15 -0500 Subject: [PATCH 2/6] AWS Debian Jessie: Install Docker 1.9.1 --- cluster/saltbase/salt/docker/init.sls | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cluster/saltbase/salt/docker/init.sls b/cluster/saltbase/salt/docker/init.sls index e24cf360bf4..5d7bde5e65c 100644 --- a/cluster/saltbase/salt/docker/init.sls +++ b/cluster/saltbase/salt/docker/init.sls @@ -208,6 +208,16 @@ net.ipv4.ip_forward: {% set override_deb_sha1='' %} {% set override_docker_ver='' %} +{% elif grains.get('cloud', '') == 'aws' + and grains.get('os_family', '') == 'Debian' + and grains.get('oscodename', '') == 'jessie' -%} +# TODO: Get from google storage? +{% set docker_pkg_name='docker-engine' %} +{% set override_docker_ver='1.9.1-0~jessie' %} +{% set override_deb='docker-engine_1.9.1-0~jessie_amd64.deb' %} +{% set override_deb_url='http://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_1.9.1-0~jessie_amd64.deb' %} +{% set override_deb_sha1='c58c39008fd6399177f6b2491222e4438f518d78' %} + # Ubuntu presents as os_family=Debian, osfullname=Ubuntu {% elif grains.get('cloud', '') == 'aws' and grains.get('os_family', '') == 'Debian' From aa57beb88559f57dec436c5e2376137aa0d957bc Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Fri, 19 Feb 2016 23:46:00 -0500 Subject: [PATCH 3/6] AWS Jessie: Find image by name This means we don't have to code the AMI ids for each region. --- cluster/aws/jessie/util.sh | 59 ++++++-------------------------------- 1 file changed, 9 insertions(+), 50 deletions(-) diff --git a/cluster/aws/jessie/util.sh b/cluster/aws/jessie/util.sh index 3af1afd7268..bca02b36bca 100644 --- a/cluster/aws/jessie/util.sh +++ b/cluster/aws/jessie/util.sh @@ -22,60 +22,19 @@ source "${KUBE_ROOT}/cluster/aws/trusty/common.sh" SSH_USER=admin # Detects the AMI to use for jessie (considering the region) -# Source: https://wiki.debian.org/Cloud/AmazonEC2Image/Jessie # # Vars set: # AWS_IMAGE function detect-jessie-image () { if [[ -z "${AWS_IMAGE-}" ]]; then - case "${AWS_REGION}" in - ap-northeast-1) - AWS_IMAGE=ami-e624fbe6 - ;; - - ap-southeast-1) - AWS_IMAGE=ami-ac360cfe - ;; - - ap-southeast-2) - AWS_IMAGE=ami-bbc5bd81 - ;; - - eu-central-1) - AWS_IMAGE=ami-02b78e1f - ;; - - eu-west-1) - AWS_IMAGE=ami-e31a6594 - ;; - - sa-east-1) - AWS_IMAGE=ami-0972f214 - ;; - - us-east-1) - AWS_IMAGE=ami-116d857a - ;; - - us-west-1) - AWS_IMAGE=ami-05cf2541 - ;; - - us-west-2) - AWS_IMAGE=ami-818eb7b1 - ;; - - cn-north-1) - AWS_IMAGE=ami-888815b1 - ;; - - us-gov-west-1) - AWS_IMAGE=ami-35b5d516 - ;; - - *) - echo "Please specify AWS_IMAGE directly (region ${AWS_REGION} not recognized)" - exit 1 - esac + # TODO: publish on a k8s AWS account + aws_account="721322707521" + # TODO: we could use tags for the image + image_name="k8s-1.2-debian-jessie-amd64-hvm-2016-02-23-ebs" + AWS_IMAGE=`aws ec2 describe-images --owner ${aws_account} --filters Name=name,Values=${image_name} --query Images[].ImageId --output text` + if [[ -z "${AWS_IMAGE:-}" ]]; then + echo "Please specify AWS_IMAGE directly (image ${image_name} not found in region ${AWS_REGION})" + exit 1 + fi fi } From 41e2a4b0c3e315e5c1ae3022ae68472458903498 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Tue, 23 Feb 2016 23:18:21 -0500 Subject: [PATCH 4/6] AWS Jessie image: preinstall docker 1.9.1 Given the problems with docker's installation, we should be baking it into the image. --- cluster/cloudimages/k8s-ebs-jessie-amd64-hvm.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cluster/cloudimages/k8s-ebs-jessie-amd64-hvm.yml b/cluster/cloudimages/k8s-ebs-jessie-amd64-hvm.yml index c81dead2904..47fd4b8c827 100644 --- a/cluster/cloudimages/k8s-ebs-jessie-amd64-hvm.yml +++ b/cluster/cloudimages/k8s-ebs-jessie-amd64-hvm.yml @@ -77,6 +77,13 @@ plugins: # 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' ] + # We perform a full replacement of some grub conf variables: # GRUB_CMDLINE_LINUX_DEFAULT (add memory cgroup) # GRUB_TIMEOUT (remove boot delay) From 7f3bbe1dfe6606b62886c115f723a3acab2cee38 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Tue, 23 Feb 2016 23:20:43 -0500 Subject: [PATCH 5/6] AWS kube-up: Bump to the latest Jessie image, allow overriding Jessie image can be selected by name using AWS_IMAGE_NAME. This is a little easier than specifying the AMI ID. --- cluster/aws/jessie/util.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cluster/aws/jessie/util.sh b/cluster/aws/jessie/util.sh index bca02b36bca..3af2f65ad4c 100644 --- a/cluster/aws/jessie/util.sh +++ b/cluster/aws/jessie/util.sh @@ -30,10 +30,12 @@ function detect-jessie-image () { # TODO: publish on a k8s AWS account aws_account="721322707521" # TODO: we could use tags for the image - image_name="k8s-1.2-debian-jessie-amd64-hvm-2016-02-23-ebs" - AWS_IMAGE=`aws ec2 describe-images --owner ${aws_account} --filters Name=name,Values=${image_name} --query Images[].ImageId --output text` - if [[ -z "${AWS_IMAGE:-}" ]]; then - echo "Please specify AWS_IMAGE directly (image ${image_name} not found in region ${AWS_REGION})" + if [[ -z "${AWS_IMAGE_NAME:-}" ]]; then + AWS_IMAGE_NAME="k8s-1.2-debian-jessie-amd64-hvm-2016-02-24-ebs" + fi + AWS_IMAGE=`aws ec2 describe-images --owner ${aws_account} --filters Name=name,Values=${AWS_IMAGE_NAME} --query Images[].ImageId --output text` + if [[ -z "${AWS_IMAGE-}" ]]; then + echo "Please specify AWS_IMAGE directly (image ${AWS_IMAGE_NAME} not found in region ${AWS_REGION})" exit 1 fi fi From 5d7ed4d6e70cd8921e0bc26d275f610d603bda87 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Tue, 23 Feb 2016 23:44:00 -0500 Subject: [PATCH 6/6] AWS kube-up: Stop docker before moving /mnt/docker On Jessie, we now preinstall Docker. Before moving /mnt/docker, make sure we stop the docker service. --- cluster/aws/templates/format-disks.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cluster/aws/templates/format-disks.sh b/cluster/aws/templates/format-disks.sh index 9afc1b93fd9..adf3396778d 100644 --- a/cluster/aws/templates/format-disks.sh +++ b/cluster/aws/templates/format-disks.sh @@ -190,6 +190,9 @@ else fi if [[ -n "${move_docker}" ]]; then + # Stop docker if it is running, so we can move its files + systemctl stop docker || true + # Move docker to e.g. /mnt # but only if it is a directory, not a symlink left over from a previous run if [[ -d /var/lib/docker ]]; then