Skip to content

Commit

Permalink
Remove support for CoreOS Container Linux (kubernetes-sigs#6576)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmelbourne authored Aug 28, 2020
1 parent 6e938a3 commit 058438a
Show file tree
Hide file tree
Showing 44 changed files with 150 additions and 103 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ vagrant up
- [HA mode](docs/ha-mode.md)
- [Network plugins](#network-plugins)
- [Vagrant install](docs/vagrant.md)
- [CoreOS bootstrap](docs/coreos.md)
- [Flatcar Container Linux bootstrap](docs/flatcar.md)
- [Fedora CoreOS bootstrap](docs/fcos.md)
- [Debian Jessie setup](docs/debian.md)
- [openSUSE setup](docs/opensuse.md)
Expand All @@ -102,7 +102,7 @@ vagrant up

## Supported Linux Distributions

- **Container Linux by CoreOS**
- **Flatcar Container Linux by Kinvolk**
- **Debian** Buster, Jessie, Stretch, Wheezy
- **Ubuntu** 16.04, 18.04, 20.04
- **CentOS/RHEL** 7, 8 (experimental: see [centos 8 notes](docs/centos8.md))
Expand Down
4 changes: 0 additions & 4 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ Vagrant.require_version ">= 2.0.0"

CONFIG = File.join(File.dirname(__FILE__), ENV['KUBESPRAY_VAGRANT_CONFIG'] || 'vagrant/config.rb')

COREOS_URL_TEMPLATE = "https://storage.googleapis.com/%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json"
FLATCAR_URL_TEMPLATE = "https://%s.release.flatcar-linux.net/amd64-usr/current/flatcar_production_vagrant.json"

# Uniq disk UUID for libvirt
DISK_UUID = Time.now.utc.to_i

SUPPORTED_OS = {
"coreos-stable" => {box: "coreos-stable", user: "core", box_url: COREOS_URL_TEMPLATE % ["stable"]},
"coreos-alpha" => {box: "coreos-alpha", user: "core", box_url: COREOS_URL_TEMPLATE % ["alpha"]},
"coreos-beta" => {box: "coreos-beta", user: "core", box_url: COREOS_URL_TEMPLATE % ["beta"]},
"flatcar-stable" => {box: "flatcar-stable", user: "core", box_url: FLATCAR_URL_TEMPLATE % ["stable"]},
"flatcar-beta" => {box: "flatcar-beta", user: "core", box_url: FLATCAR_URL_TEMPLATE % ["beta"]},
"flatcar-alpha" => {box: "flatcar-alpha", user: "core", box_url: FLATCAR_URL_TEMPLATE % ["alpha"]},
Expand Down
10 changes: 5 additions & 5 deletions contrib/terraform/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export TF_VAR_AWS_SECRET_ACCESS_KEY ="xxx"
export TF_VAR_AWS_SSH_KEY_NAME="yyy"
export TF_VAR_AWS_DEFAULT_REGION="zzz"
```
- Update `contrib/terraform/aws/terraform.tfvars` with your data. By default, the Terraform scripts use CoreOS as base image. If you want to change this behaviour, see note "Using other distrib than CoreOs" below.
- Update `contrib/terraform/aws/terraform.tfvars` with your data. By default, the Terraform scripts use Ubuntu 18.04 LTS (Bionic) as base image. If you want to change this behaviour, see note "Using other distrib than Ubuntu" below.
- Create an AWS EC2 SSH Key
- Run with `terraform apply --var-file="credentials.tfvars"` or `terraform apply` depending if you exported your AWS credentials

Expand All @@ -41,12 +41,12 @@ ssh -F ./ssh-bastion.conf user@$ip

- Once the infrastructure is created, you can run the kubespray playbooks and supply inventory/hosts with the `-i` flag.

Example (this one assumes you are using CoreOS)
Example (this one assumes you are using Ubuntu)
```commandline
ansible-playbook -i ./inventory/hosts ./cluster.yml -e ansible_user=core -b --become-user=root --flush-cache
ansible-playbook -i ./inventory/hosts ./cluster.yml -e ansible_user=ubuntu -b --become-user=root --flush-cache
```
***Using other distrib than CoreOs***
If you want to use another distribution than CoreOS, you can modify the search filters of the 'data "aws_ami" "distro"' in variables.tf.
***Using other distrib than Ubuntu***
If you want to use another distribution than Ubuntu 18.04 (Bionic) LTS, you can modify the search filters of the 'data "aws_ami" "distro"' in variables.tf.

For example, to use:
- Debian Jessie, replace 'data "aws_ami" "distro"' in variables.tf with
Expand Down
4 changes: 2 additions & 2 deletions contrib/terraform/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ data "aws_ami" "distro" {

filter {
name = "name"
values = ["CoreOS-stable-*"]
values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"]
}

filter {
name = "virtualization-type"
values = ["hvm"]
}

owners = ["595879546273"] #CoreOS
owners = ["099720109477"] # Canonical
}

//AWS VPC Variables
Expand Down
10 changes: 5 additions & 5 deletions contrib/terraform/openstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ specify:
- Size of the non-ephemeral volumes to be attached to store the GlusterFS bricks
- Other properties related to provisioning the hosts

Even if you are using Container Linux by CoreOS for your cluster, you will still
Even if you are using Flatcar Container Linux by Kinvolk for your cluster, you will still
need the GlusterFS VMs to be based on either Debian or RedHat based images.
Container Linux by CoreOS cannot serve GlusterFS, but can connect to it through
Flatcar Container Linux by Kinvolk cannot serve GlusterFS, but can connect to it through
binaries available on hyperkube v1.4.3_coreos.0 or higher.

## Requirements
Expand Down Expand Up @@ -482,7 +482,7 @@ So, either a bastion host, or at least master/node with a floating IP are requir

#### Test access

Make sure you can connect to the hosts. Note that Container Linux by CoreOS will have a state `FAILED` due to Python not being present. This is okay, because Python will be installed during bootstrapping, so long as the hosts are not `UNREACHABLE`.
Make sure you can connect to the hosts. Note that Flatcar Container Linux by Kinvolk will have a state `FAILED` due to Python not being present. This is okay, because Python will be installed during bootstrapping, so long as the hosts are not `UNREACHABLE`.

```
$ ansible -i inventory/$CLUSTER/hosts -m ping all
Expand Down Expand Up @@ -510,7 +510,7 @@ Edit `inventory/$CLUSTER/group_vars/all/all.yml`:
# Directory where the binaries will be installed
# Default:
# bin_dir: /usr/local/bin
# For Container Linux by CoreOS:
# For Flatcar Container Linux by Kinvolk:
bin_dir: /opt/bin
```
- and **cloud_provider**:
Expand All @@ -531,7 +531,7 @@ kube_network_plugin: flannel
# Can be docker_dns, host_resolvconf or none
# Default:
# resolvconf_mode: docker_dns
# For Container Linux by CoreOS:
# For Flatcar Container Linux by Kinvolk:
resolvconf_mode: host_resolvconf
```
- Set max amount of attached cinder volume per host (default 256)
Expand Down
2 changes: 1 addition & 1 deletion contrib/terraform/packet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ If you have deployed and destroyed a previous iteration of your cluster, you wil

#### Test access

Make sure you can connect to the hosts. Note that Container Linux by CoreOS will have a state `FAILED` due to Python not being present. This is okay, because Python will be installed during bootstrapping, so long as the hosts are not `UNREACHABLE`.
Make sure you can connect to the hosts. Note that Flatcar Container Linux by Kinvolk will have a state `FAILED` due to Python not being present. This is okay, because Python will be installed during bootstrapping, so long as the hosts are not `UNREACHABLE`.

```
$ ansible -i inventory/$CLUSTER/hosts -m ping all
Expand Down
4 changes: 2 additions & 2 deletions contrib/terraform/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ def packet_device(resource, tfvars=None):
'provider': 'packet',
}

if raw_attrs['operating_system'] == 'coreos_stable':
# For CoreOS set the ssh_user to core
if raw_attrs['operating_system'] == 'flatcar_stable':
# For Flatcar set the ssh_user to core
attrs.update({'ansible_ssh_user': 'core'})

# add groups based on attrs
Expand Down
6 changes: 3 additions & 3 deletions contrib/vault/roles/vault/tasks/bootstrap/ca_trust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/usr/local/share/ca-certificates/vault-ca.crt
{%- elif ansible_os_family == "RedHat" -%}
/etc/pki/ca-trust/source/anchors/vault-ca.crt
{%- elif ansible_os_family in ["Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk"] -%}
{%- elif ansible_os_family in ["Flatcar Container Linux by Kinvolk"] -%}
/etc/ssl/certs/vault-ca.pem
{%- endif %}
Expand All @@ -23,9 +23,9 @@
dest: "{{ ca_cert_path }}"
register: vault_ca_cert

- name: bootstrap/ca_trust | update ca-certificates (Debian/Ubuntu/CoreOS)
- name: bootstrap/ca_trust | update ca-certificates (Debian/Ubuntu/Flatcar)
command: update-ca-certificates
when: vault_ca_cert.changed and ansible_os_family in ["Debian", "CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk"]
when: vault_ca_cert.changed and ansible_os_family in ["Debian", "Flatcar Container Linux by Kinvolk"]

- name: bootstrap/ca_trust | update ca-certificates (RedHat)
command: update-ca-trust extract
Expand Down
2 changes: 1 addition & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* [vSphere](/docs/vsphere.md)
* Operating Systems
* [Debian](docs/debian.md)
* [Coreos](docs/coreos.md)
* [Flatcar Container Linux](docs/flatcar.md)
* [Fedora CoreOS](docs/fcos.md)
* [OpenSUSE](docs/opensuse.md)
* Advanced
Expand Down
14 changes: 14 additions & 0 deletions docs/flatcar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Flatcar Container Linux bootstrap
===============

Example with Ansible:

Before running the cluster playbook you must satisfy the following requirements:

General Flatcar Pre-Installation Notes:

- Ensure that the bin_dir is set to `/opt/bin`
- ansible_python_interpreter should be `/opt/bin/python`. This will be laid down by the bootstrap task.
- The default resolvconf_mode setting of `docker_dns` **does not** work for Flatcar. This is because we do not edit the systemd service file for docker on Flatcar nodes. Instead, just use the `host_resolvconf` mode. It should work out of the box.

Then you can proceed to [cluster deployment](#run-deployment)
2 changes: 1 addition & 1 deletion docs/vagrant.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ By default, Vagrant uses Ubuntu 18.04 box to provision a local cluster. You may
Customize `$os` variable in `Vagrantfile` or as override, e.g.,:

```ShellSession
echo '$os = "coreos-stable"' >> vagrant/config.rb
echo '$os = "flatcar-stable"' >> vagrant/config.rb
```

The supported operating systems for vagrant are defined in the `SUPPORTED_OS` constant in the `Vagrantfile`.
Expand Down
2 changes: 1 addition & 1 deletion roles/bootstrap-os/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Variables are listed with their default values, if applicable.

### Per distribution variables

#### CoreOS
#### Flatcar Container Linux

* `coreos_locksmithd_disable: false`
Whether `locksmithd` (responsible for rolling restarts) should be disabled or be left alone.
Expand Down
2 changes: 1 addition & 1 deletion roles/bootstrap-os/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Use the fastestmirror yum plugin
centos_fastestmirror_enabled: false

## CoreOS specific variables
## Flatcar Container Linux specific variables
# Disable locksmithd or leave it in its current state
coreos_locksmithd_disable: false

Expand Down
40 changes: 40 additions & 0 deletions roles/bootstrap-os/tasks/bootstrap-flatcar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# Flatcar Container Linux ships without Python installed

- name: Check if bootstrap is needed
raw: stat /opt/bin/.bootstrapped
register: need_bootstrap
environment: {}
failed_when: false
changed_when: false
tags:
- facts

- name: Force binaries directory for Flatcar Container Linux by Kinvolk
set_fact:
bin_dir: "/opt/bin"
tags:
- facts

- name: Run bootstrap.sh
script: bootstrap.sh
become: true
environment:
http_proxy: "{{ http_proxy | default('') }}"
https_proxy: "{{ https_proxy | default('') }}"
when:
- need_bootstrap.rc != 0

- name: Set the ansible_python_interpreter fact
set_fact:
ansible_python_interpreter: "{{ bin_dir }}/python"
tags:
- facts

- name: Disable auto-upgrade
systemd:
name: locksmithd.service
masked: true
state: stopped
when:
- coreos_locksmithd_disable
12 changes: 6 additions & 6 deletions roles/bootstrap-os/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
- include_tasks: bootstrap-fedora-coreos.yml
when: '"ID=fedora" in os_release.stdout and "VARIANT_ID=coreos" in os_release.stdout'

- include_tasks: bootstrap-coreos.yml
- include_tasks: bootstrap-flatcar.yml
when:
- '"CoreOS" in os_release.stdout or "Flatcar" in os_release.stdout'
- '"Flatcar" in os_release.stdout'
- '"ID=fedora" not in os_release.stdout'

- include_tasks: bootstrap-debian.yml
Expand Down Expand Up @@ -50,17 +50,17 @@
name: "{{ inventory_hostname }}"
when:
- override_system_hostname
- ansible_os_family not in ['Suse', 'Container Linux by CoreOS', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] and not is_fedora_coreos
- ansible_os_family not in ['Suse', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] and not is_fedora_coreos

# (2/3)
- name: Assign inventory name to unconfigured hostnames (CoreOS, non-Flatcar, Suse and ClearLinux only)
- name: Assign inventory name to unconfigured hostnames (CoreOS, Flatcar, Suse and ClearLinux only)
command: "hostnamectl set-hostname {{ inventory_hostname }}"
register: hostname_changed
become: true
changed_when: false
when:
- override_system_hostname
- ansible_os_family in ['Suse', 'Container Linux by CoreOS', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] or is_fedora_coreos
- ansible_os_family in ['Suse', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] or is_fedora_coreos

# (3/3)
- name: Update hostname fact (CoreOS, Flatcar, Suse and ClearLinux only)
Expand All @@ -69,7 +69,7 @@
filter: ansible_hostname
when:
- override_system_hostname
- ansible_os_family in ['Suse', 'Flatcar Container Linux by Kinvolk', 'Container Linux by CoreOS', 'ClearLinux'] or is_fedora_coreos
- ansible_os_family in ['Suse', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] or is_fedora_coreos

- name: "Install ceph-commmon package"
package:
Expand Down
2 changes: 1 addition & 1 deletion roles/container-engine/docker/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
service:
name: docker.socket
state: restarted
when: ansible_os_family in ['Coreos', 'CoreOS', 'Container Linux by CoreOS', 'Flatcar', 'Flatcar Container Linux by Kinvolk'] or is_fedora_coreos
when: ansible_os_family in ['Flatcar Container Linux by Kinvolk'] or is_fedora_coreos

- name: Docker | reload docker
service:
Expand Down
12 changes: 6 additions & 6 deletions roles/container-engine/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
docker requires a minimum kernel version of
{{ docker_kernel_min_version }} on
{{ ansible_distribution }}-{{ ansible_distribution_version }}
when: (not ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk", "ClearLinux"]) and (ansible_kernel is version(docker_kernel_min_version, "<"))
when: (not ansible_os_family in ["Flatcar Container Linux by Kinvolk", "ClearLinux"]) and (ansible_kernel is version(docker_kernel_min_version, "<"))
tags:
- facts

Expand Down Expand Up @@ -74,15 +74,15 @@
retries: 4
delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ docker_repo_key_info.repo_keys }}"
when: not (ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree)
when: not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree)

- name: ensure docker-ce repository is enabled
action: "{{ docker_repo_info.pkg_repo }}"
args:
repo: "{{ item }}"
state: present
with_items: "{{ docker_repo_info.repos }}"
when: not (ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree) and (docker_repo_info.repos|length > 0)
when: not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree) and (docker_repo_info.repos|length > 0)

- name: ensure docker-engine repository public key is installed
action: "{{ dockerproject_repo_key_info.pkg_key }}"
Expand All @@ -96,7 +96,7 @@
delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ dockerproject_repo_key_info.repo_keys }}"
when:
- not (ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree)
- not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree)
- use_docker_engine is defined and use_docker_engine

- name: ensure docker-engine repository is enabled
Expand All @@ -107,7 +107,7 @@
with_items: "{{ dockerproject_repo_info.repos }}"
when:
- use_docker_engine is defined and use_docker_engine
- not (ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree) and (dockerproject_repo_info.repos|length > 0)
- not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "RedHat", "Suse", "ClearLinux"] or is_ostree) and (dockerproject_repo_info.repos|length > 0)

- name: Configure docker repository on Fedora
template:
Expand Down Expand Up @@ -172,7 +172,7 @@
delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ docker_package_info.pkgs }}"
notify: restart docker
when: not (ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk", "ClearLinux"] or is_ostree) and (docker_package_info.pkgs|length > 0)
when: not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "ClearLinux"] or is_ostree) and (docker_package_info.pkgs|length > 0)
ignore_errors: true

- name: Ensure docker packages are installed
Expand Down
2 changes: 1 addition & 1 deletion roles/container-engine/docker/tasks/systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
dest: /etc/systemd/system/docker.service
register: docker_service_file
notify: restart docker
when: not ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk"]
when: not ansible_os_family in ["Flatcar Container Linux by Kinvolk"]

- name: Write docker options systemd drop-in
template:
Expand Down
6 changes: 3 additions & 3 deletions roles/download/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ skip_kubeadm_images: false
kubeadm_images: {}

# if this is set to true will only download files once. Doesn't work
# on Container Linux by CoreOS unless the download_localhost is true and localhost
# on Flatcar Container Linux by Kinvolk unless the download_localhost is true and localhost
# is running another OS type. Default compress level is 1 (fastest).
download_run_once: false
download_compress: 1
Expand All @@ -29,7 +29,7 @@ download_container: true

# if this is set to true, uses the localhost for download_run_once mode
# (requires docker and sudo to access docker). You may want this option for
# local caching of docker images or for Container Linux by CoreOS cluster nodes.
# local caching of docker images or for Flatcar Container Linux by Kinvolk cluster nodes.
# Otherwise, uses the first node in the kube-master group to store images
# in the download_run_once mode.
download_localhost: false
Expand Down Expand Up @@ -920,7 +920,7 @@ downloads:
- k8s-cluster

install_socat:
enabled: "{{ ansible_os_family in ['CoreOS', 'Container Linux by CoreOS', 'Flatcar', 'Flatcar Container Linux by Kinvolk'] }}"
enabled: "{{ ansible_os_family in ['Flatcar Container Linux by Kinvolk'] }}"
container: true
repo: "{{ install_socat_image_repo }}"
tag: "{{ install_socat_image_tag }}"
Expand Down
Loading

0 comments on commit 058438a

Please sign in to comment.