kubernetes + containerd installer
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
This commit is contained in:
51
contrib/ansible/tasks/binaries.yaml
Normal file
51
contrib/ansible/tasks/binaries.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
- name: "Create a directory to download binaries"
|
||||
file: path={{ cri_release_directory }} state=directory
|
||||
|
||||
- name: "Get Containerd and CRI-Containerd"
|
||||
get_url:
|
||||
validate_certs: "no"
|
||||
url: "https://storage.googleapis.com/cri-containerd-staging/cri-containerd-{{ cri_containerd_release_version }}.tar.gz"
|
||||
dest: "{{ cri_release_directory }}"
|
||||
mode: 0755
|
||||
|
||||
- name: "Unpack Containerd and CRI-Containerd"
|
||||
unarchive:
|
||||
src: "{{ cri_release_directory }}cri-containerd-{{ cri_containerd_release_version }}.tar.gz"
|
||||
dest: "{{ cri_release_directory }}"
|
||||
remote_src: yes
|
||||
|
||||
- name: "Install the containerd and cri-containerd binaries"
|
||||
copy:
|
||||
src: "{{ cri_release_directory }}usr/local/bin/{{ item }}"
|
||||
dest: "{{ local_bin_dir }}{{ item }}"
|
||||
mode: 0755
|
||||
remote_src: yes
|
||||
with_items:
|
||||
- containerd
|
||||
- containerd-stress
|
||||
- containerd-shim
|
||||
- cri-containerd
|
||||
- ctr
|
||||
- crictl
|
||||
|
||||
- name: "Install runc"
|
||||
copy:
|
||||
src: "{{ cri_release_directory }}usr/local/sbin/{{ item }}"
|
||||
dest: "{{ local_sbin_dir }}{{ item }}"
|
||||
mode: 0755
|
||||
remote_src: yes
|
||||
with_items:
|
||||
- runc
|
||||
|
||||
- name: "Copy containerd systemd service unit"
|
||||
template: src=../../systemd-units/containerd.service dest=/etc/systemd/system/containerd.service
|
||||
|
||||
- name: "Copy cri-containerd systemd service unit"
|
||||
template: src=../../systemd-units/cri-containerd.service dest=/etc/systemd/system/cri-containerd.service
|
||||
|
||||
- name: "Create a directory for cni binary"
|
||||
file: path={{ cni_bin_dir }} state=directory
|
||||
|
||||
- name: "Create a directory for cni config files"
|
||||
file: path={{ cni_conf_dir }} state=directory
|
||||
13
contrib/ansible/tasks/bootstrap_centos.yaml
Normal file
13
contrib/ansible/tasks/bootstrap_centos.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: "Install required packages on CentOS "
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
with_items:
|
||||
- unzip
|
||||
- tar
|
||||
- btrfs-progs-devel
|
||||
- libseccomp-devel
|
||||
- util-linux
|
||||
- socat
|
||||
- libselinux-python
|
||||
16
contrib/ansible/tasks/bootstrap_ubuntu.yaml
Normal file
16
contrib/ansible/tasks/bootstrap_ubuntu.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: "Install required packages on Ubuntu"
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
with_items:
|
||||
- unzip
|
||||
- tar
|
||||
- apt-transport-https
|
||||
- btrfs-tools
|
||||
- libapparmor-dev
|
||||
- libseccomp-dev # Revisit the need and alternatives for all -dev packages
|
||||
- libseccomp2
|
||||
- socat
|
||||
- util-linux
|
||||
# TODO: Limited support for trusty for nsenter. Need to handle/verify
|
||||
50
contrib/ansible/tasks/k8s.yaml
Normal file
50
contrib/ansible/tasks/k8s.yaml
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
- name: "Add gpg key (Ubuntu)"
|
||||
apt_key:
|
||||
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
|
||||
state: present
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
|
||||
- name: "Add kubernetes source list (Ubuntu)"
|
||||
apt_repository:
|
||||
repo: "deb http://apt.kubernetes.io/ kubernetes-{{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
filename: "kubernetes"
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
|
||||
- name: "Update the repository cache (Ubuntu)"
|
||||
apt:
|
||||
update_cache: yes
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
|
||||
- name: "Add Kubernetes repository and install gpg key (CentOS)"
|
||||
yum_repository:
|
||||
name: kubernetes
|
||||
description: Kubernetes repository
|
||||
baseurl: https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
|
||||
gpgcheck: yes
|
||||
enabled: yes
|
||||
repo_gpgcheck: yes
|
||||
gpgkey: https://packages.cloud.google.com/yum/doc/yum-key.gpg
|
||||
when: ansible_distribution == "CentOS"
|
||||
|
||||
- name: "Disable SELinux (CentOS)"
|
||||
selinux:
|
||||
state: disabled
|
||||
when: ansible_distribution == "CentOS"
|
||||
|
||||
- name: "Install kubelet,kubeadm,kubectl (CentOS)"
|
||||
yum: state=present name={{ item }}
|
||||
with_items:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
when: ansible_distribution == "CentOS"
|
||||
|
||||
- name: "Install kubelet, kubeadm, kubectl (Ubuntu)"
|
||||
apt: name={{item}} state=installed
|
||||
with_items:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
Reference in New Issue
Block a user