Skip to content

Instantly share code, notes, and snippets.

@jasonbishop
Last active March 23, 2016 22:32
Show Gist options
  • Select an option

  • Save jasonbishop/7b1210b99ac642253d15 to your computer and use it in GitHub Desktop.

Select an option

Save jasonbishop/7b1210b99ac642253d15 to your computer and use it in GitHub Desktop.
kubernetes and docker registry

checkout repo for your ansible footprint

git clone https://github.com/jasonbishop/contrib.git
cd contrib/ansible/roles
git clone https://github.com/jasonbishop/ansible-docker-registry.git

apt-get install python-netaddr python-dev gcc
pip install ansible

get kubectl for your ansible deploy host

linux

https_proxy=https://10.1.52.100:8080 curl -O https://storage.googleapis.com/kubernetes-release/release/v1.2.0/bin/linux/amd64/kubectl

mac

https_proxy=https://10.1.52.100:8080 curl -O https://storage.googleapis.com/kubernetes-release/release/v1.2.0/bin/darwin/amd64/kubectl

boot centos vm's

create proxyuserdata file with following contents:

 #!/bin/bash

cat >> /etc/yum.conf <<EOF

proxy=http://10.1.52.100:8080

EOF
yum makecache

boot the VM's, noting that you will need to pull different FIP's than these

nova boot --flavor m1.medium --image CentOS-7-x86_64 --nic net-id=62b25c9a-c921-49e7-9b68-bbc0d1de63eb --key-name jason --user-data proxyuserdata centosregistry
nova boot --flavor m1.medium --image CentOS-7-x86_64 --nic net-id=62b25c9a-c921-49e7-9b68-bbc0d1de63eb --key-name jason --user-data proxyuserdata k8scentostarget
nova boot --flavor m1.medium --image CentOS-7-x86_64 --nic net-id=62b25c9a-c921-49e7-9b68-bbc0d1de63eb --key-name jason --user-data proxyuserdata k8scentostarget2
nova boot --flavor m1.medium --image CentOS-7-x86_64 --nic net-id=62b25c9a-c921-49e7-9b68-bbc0d1de63eb --key-name jason --user-data proxyuserdata k8snfsserver

nova floating-ip-associate k8scentostarget2 10.76.16.129
nova floating-ip-associate centosregistry 10.76.16.102
nova floating-ip-associate k8scentostarget 10.76.16.120
nova floating-ip-associate k8snfsserver 10.76.16.118

create inventory file with following contents, replacing these FIP's with yours

edit contrib/ansible/inventory with following contents:

[masters]
10.76.16.120

[etcd]
10.76.16.120

[nodes]
10.76.16.120
10.76.16.129

[registry]
10.76.16.102

[nfsserver]
10.76.16.118

update docker registry ip

edit ansible defaults file vi contrib/ansible/roles/ansible-docker-registry/defaults/main.yml and set the correct ip for docker_registry_ip

run ansible

check that your ssh keys are setup so you can login as centos on the newly-booted VM's. here we do a ping command first so all of the ssh host keys can be accepted. once that is done, run the cluster.yml playbook

cd contrib/ansible
ansible -c paramiko -i inventory.example.single_master all -m ping
ansible-playbook -v -v -v -v -c paramiko -i inventory-file cluster.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment