Move kubectl to docker container

Nearly the last stage of moving all components to containers.
Kubectl will be called from hyperkube image.

Remaining tasks:
 * Move kube_version variable to kubernetes/preinstall
 * Drop placeholder download.nothing requirement
This commit is contained in:
Matthew Mosesohn 2016-07-25 13:56:58 +03:00
parent af4c41f32e
commit 862e3e0386
4 changed files with 22 additions and 5 deletions

View file

@ -68,3 +68,11 @@
state: started state: started
with_items: with_items:
- docker - docker
- name: add ansible_user to docker group
user:
name: "{{ ansible_user }}"
groups: docker
append: yes
when: ansible_user is defined and ansible_user != "root"

View file

@ -1,6 +1,6 @@
--- ---
dependencies: dependencies:
- role: download - role: download # For kube_version variable
file: "{{ downloads.kubernetes_kubectl }}" file: "{{ downloads.nothing }}"
- { role: etcd } - { role: etcd }
- { role: kubernetes/node } - { role: kubernetes/node }

View file

@ -7,9 +7,11 @@
dest: /etc/bash_completion.d/kubectl.sh dest: /etc/bash_completion.d/kubectl.sh
when: ansible_os_family in ["Debian","RedHat"] when: ansible_os_family in ["Debian","RedHat"]
- name: Copy kubectl binary - name: Create kubectl launcher
command: rsync -piu "{{ local_release_dir }}/kubernetes/bin/kubectl" "{{ bin_dir }}/kubectl" template:
changed_when: false src: kubectl-container.j2
dest: "{{ bin_dir }}/kubectl"
register: kubectl_launcher
- meta: flush_handlers - meta: flush_handlers

View file

@ -0,0 +1,7 @@
#!/bin/bash
# /etc/kubernetes included in case kubeconfig and/or certs used
/usr/bin/docker run --rm --net=host \
-v /etc/kubernetes:/etc/kubernetes:ro \
{{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} \
/hyperkube kubectl \
$@