forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fedora CoreOS support (kubernetes-sigs#5657)
* fedora coreos support - bootstrap and new fact for * fedora coreos support - fix bootstrap condition * fedora coreos support - allow customize packages for fedora coreos bootstrap * fedora coreos support - prevent install ptyhon3 and epel via dnf for fedora coreos * fedora coreos support - handle all ostree like os in same way * fedora coreos support - handle all ostree like os in same way for crio * fedora coreos support - add fcos documentations
- Loading branch information
Showing
17 changed files
with
222 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Fedora CoreOS | ||
|
||
Tested with stable version 31.20200223.3.0 | ||
Because package installation with `rpm-ostree` requires a reboot, playbook may fail while bootstrap. | ||
Restart playbook again. | ||
|
||
## Containers | ||
|
||
Tested with | ||
|
||
- docker | ||
- crio | ||
|
||
### docker | ||
|
||
OS base packages contains docker. | ||
|
||
### cri-o | ||
|
||
To use `cri-o` disable docker service with ignition: | ||
|
||
```yaml | ||
#workaround, see https://github.com/coreos/fedora-coreos-tracker/issues/229 | ||
systemd: | ||
units: | ||
- name: docker.service | ||
enabled: false | ||
contents: | | ||
[Unit] | ||
Description=disable docker | ||
[Service] | ||
[Install] | ||
WantedBy=multi-user.target | ||
``` | ||
## libvirt setup | ||
### Prepare | ||
Prepare ignition and serve via http (a.e. python -m SimpleHTTPServer ) | ||
```json | ||
{ | ||
"ignition": { | ||
"version": "3.0.0" | ||
}, | ||
|
||
"passwd": { | ||
"users": [ | ||
{ | ||
"name": "adi", | ||
"passwordHash": "$1$.RGu8J4x$U7uxcOg/eotTEIRxhk62I0", | ||
"sshAuthorizedKeys": [ | ||
"ssh-rsa ..fillyouruser" | ||
], | ||
"groups": [ "wheel" ] | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
### create guest | ||
|
||
```shell script | ||
fcos_version=31.20200223.3.0 | ||
kernel=https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/${fcos_version}/x86_64/fedora-coreos-${fcos_version}-live-kernel-x86_64 | ||
initrd=https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/${fcos_version}/x86_64/fedora-coreos-${fcos_version}-live-initramfs.x86_64.img | ||
ignition_url=http://mywebserver/fcos.ign | ||
kernel_args="ip=dhcp rd.neednet=1 console=tty0 coreos.liveiso=/ console=ttyS0 coreos.inst.install_dev=/dev/sda coreos.inst.stream=stable coreos.inst.ignition_url=${ignition_url}" | ||
sudo virt-install --name ${machine_name} --ram 4048 --graphics=none --vcpus 2 --disk size=20 \ | ||
--network bridge=virbr0 \ | ||
--install kernel=${kernel},initrd=${initrd},kernel_args_overwrite=yes,kernel_args="${kernel_args}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
|
||
- name: Check if bootstrap is needed | ||
raw: which python | ||
register: need_bootstrap | ||
failed_when: false | ||
changed_when: false | ||
tags: | ||
- facts | ||
|
||
- name: Install required packages on fedora coreos | ||
raw: "export http_proxy={{ http_proxy | default('') }};rpm-ostree install {{ fedora_coreos_packages|join(' ') }}" | ||
become: true | ||
when: need_bootstrap.rc != 0 | ||
|
||
# playbook fails because connection lost | ||
- name: Reboot immediately for updated ostree, please run playbook again if failed first time. | ||
raw: "nohup bash -c 'sleep 5s && shutdown -r now'" | ||
become: true | ||
ignore_errors: yes | ||
when: need_bootstrap.rc != 0 | ||
|
||
- name: Wait for the reboot to complete | ||
wait_for_connection: | ||
timeout: 240 | ||
connect_timeout: 20 | ||
delay: 5 | ||
sleep: 5 | ||
when: need_bootstrap.rc != 0 | ||
|
||
- name: Store the fact if this is an fedora core os host | ||
set_fact: | ||
is_fedora_coreos: True | ||
tags: | ||
- facts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.