add base
This commit is contained in:
19
ignition/build.sh
Executable file
19
ignition/build.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
# https://devnonsense.com/posts/k3s-on-fedora-coreos-bare-metal/
|
||||
# https://www.murillodigital.com/tech_talk/k3s_in_coreos/
|
||||
|
||||
NODE_PREFIX="k3s-"
|
||||
IP_PREFIX="10.3.4.111"
|
||||
|
||||
FIRST_NODE_INDEX="1"
|
||||
NODES_INDEX="2 3 4 5 6"
|
||||
|
||||
TOKEN=$1
|
||||
|
||||
podman run -i --rm quay.io/coreos/butane:release --pretty --strict < template01.yaml > $NODE_PREFIX$FIRST_NODE_INDEX.json
|
||||
|
||||
if [ ! -z $1 ]; then
|
||||
echo "Token: $TOKEN"
|
||||
for NODE in $NODES_INDEX; do
|
||||
sed "s/SEDtokenSED/${TOKEN}/g;s/SEDipSED/${NODE}/g" template02.yaml | podman run -i --rm quay.io/coreos/butane:release --pretty --strict > $NODE_PREFIX$NODE.json
|
||||
done
|
||||
fi
|
||||
143
ignition/template01.yaml
Normal file
143
ignition/template01.yaml
Normal file
@@ -0,0 +1,143 @@
|
||||
variant: fcos
|
||||
version: 1.5.0
|
||||
systemd:
|
||||
units:
|
||||
- name: getty@tty1.service
|
||||
dropins:
|
||||
- name: autologin-core.conf
|
||||
contents: |
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/usr/sbin/agetty --autologin core --noclear %I $TERM
|
||||
- name: run-k3s-prereq-installer.service
|
||||
enabled: true
|
||||
contents: |
|
||||
[Unit]
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Before=systemd-user-sessions.service
|
||||
OnFailure=emergency.target
|
||||
OnFailureJobMode=replace-irreversibly
|
||||
ConditionPathExists=!/var/lib/k3s-prereq-installed
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/run-k3s-prereq-installer
|
||||
ExecStartPost=/usr/bin/touch /var/lib/k3s-prereq-installed
|
||||
ExecStartPost=/usr/bin/systemctl --no-block reboot
|
||||
StandardOutput=kmsg+console
|
||||
StandardError=kmsg+console
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
- name: run-k3s-installer.service
|
||||
enabled: true
|
||||
contents: |
|
||||
[Unit]
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Before=systemd-user-sessions.service
|
||||
OnFailure=emergency.target
|
||||
OnFailureJobMode=replace-irreversibly
|
||||
ConditionPathExists=/var/lib/k3s-prereq-installed
|
||||
ConditionPathExists=!/var/lib/k3s-installed
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/run-k3s-installer
|
||||
ExecStartPost=/usr/bin/touch /var/lib/k3s-installed
|
||||
#ExecStartPost=/usr/bin/systemctl --no-block reboot
|
||||
StandardOutput=kmsg+console
|
||||
StandardError=kmsg+console
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
- name: install-open-vm-tools.service
|
||||
enabled: true
|
||||
contents: |
|
||||
[Unit]
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Before=systemd-user-sessions.service
|
||||
OnFailure=emergency.target
|
||||
OnFailureJobMode=replace-irreversibly
|
||||
ConditionPathExists=!/var/lib/open-vm-tools-installed
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/install-open-vm-tools
|
||||
ExecStartPost=/usr/bin/touch /var/lib/open-vm-tools-installed
|
||||
ExecStartPost=/usr/bin/systemctl --no-block reboot
|
||||
StandardOutput=kmsg+console
|
||||
StandardError=kmsg+console
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
storage:
|
||||
files:
|
||||
- path: /usr/local/bin/run-k3s-prereq-installer
|
||||
mode: 0755
|
||||
contents:
|
||||
inline: |
|
||||
#!/usr/bin/env sh
|
||||
main() {
|
||||
rpm-ostree install https://github.com/k3s-io/k3s-selinux/releases/download/v1.4.stable.1/k3s-selinux-1.4-1.coreos.noarch.rpm
|
||||
return 0
|
||||
}
|
||||
main
|
||||
- path: /etc/hostname
|
||||
mode: 0644
|
||||
contents:
|
||||
inline: |
|
||||
k3s-1
|
||||
- path: /etc/NetworkManager/system-connections/ens192.nmconnection
|
||||
mode: 0600
|
||||
contents:
|
||||
inline: |
|
||||
[connection]
|
||||
id=ens192
|
||||
type=ethernet
|
||||
interface-name=ens192
|
||||
[ipv4]
|
||||
address1=10.2.4.111/24,10.2.4.1
|
||||
dns=10.2.4.1;
|
||||
dns-search=example.com
|
||||
may-fail=false
|
||||
method=manual
|
||||
- path: /usr/local/bin/run-k3s-installer
|
||||
mode: 0755
|
||||
contents:
|
||||
inline: |
|
||||
#!/usr/bin/env sh
|
||||
main() {
|
||||
export K3S_KUBECONFIG_MODE="644"
|
||||
export INSTALL_K3S_EXEC=" --flannel-backend=none --disable-network-policy"
|
||||
# export INSTALL_K3S_EXEC=" --flannel-backend=none --disable-network-policy" K3S_URL="https://10.2.4.111:6443" K3S_TOKEN=""
|
||||
curl -sfL https://get.k3s.io | sh -
|
||||
return 0
|
||||
}
|
||||
main
|
||||
- path: /etc/rancher/k3s/kubelet.config
|
||||
mode: 0644
|
||||
contents:
|
||||
inline: |
|
||||
apiVersion: kubelet.config.k8s.io/v1beta1
|
||||
kind: KubeletConfiguration
|
||||
shutdownGracePeriod: 60s
|
||||
shutdownGracePeriodCriticalPods: 10s
|
||||
- path: /usr/local/bin/install-open-vm-tools
|
||||
mode: 0755
|
||||
contents:
|
||||
inline: |
|
||||
#!/usr/bin/env sh
|
||||
main() {
|
||||
while [ ! -f /var/lib/k3s-installed ] ; do
|
||||
sleep 2
|
||||
done
|
||||
rpm-ostree install open-vm-tools
|
||||
return 0
|
||||
}
|
||||
main
|
||||
passwd:
|
||||
users:
|
||||
- name: core
|
||||
password_hash: ""
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAEvf7cRxXo3dCYwLU0cxbxSgD4FabfYA2UFeZv1fwo7 akosfred
|
||||
143
ignition/template02.yaml
Normal file
143
ignition/template02.yaml
Normal file
@@ -0,0 +1,143 @@
|
||||
variant: fcos
|
||||
version: 1.5.0
|
||||
systemd:
|
||||
units:
|
||||
- name: getty@tty1.service
|
||||
dropins:
|
||||
- name: autologin-core.conf
|
||||
contents: |
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/usr/sbin/agetty --autologin core --noclear %I $TERM
|
||||
- name: run-k3s-prereq-installer.service
|
||||
enabled: true
|
||||
contents: |
|
||||
[Unit]
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Before=systemd-user-sessions.service
|
||||
OnFailure=emergency.target
|
||||
OnFailureJobMode=replace-irreversibly
|
||||
ConditionPathExists=!/var/lib/k3s-prereq-installed
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/run-k3s-prereq-installer
|
||||
ExecStartPost=/usr/bin/touch /var/lib/k3s-prereq-installed
|
||||
ExecStartPost=/usr/bin/systemctl --no-block reboot
|
||||
StandardOutput=kmsg+console
|
||||
StandardError=kmsg+console
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
- name: run-k3s-installer.service
|
||||
enabled: true
|
||||
contents: |
|
||||
[Unit]
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Before=systemd-user-sessions.service
|
||||
OnFailure=emergency.target
|
||||
OnFailureJobMode=replace-irreversibly
|
||||
ConditionPathExists=/var/lib/k3s-prereq-installed
|
||||
ConditionPathExists=!/var/lib/k3s-installed
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/run-k3s-installer
|
||||
ExecStartPost=/usr/bin/touch /var/lib/k3s-installed
|
||||
#ExecStartPost=/usr/bin/systemctl --no-block reboot
|
||||
StandardOutput=kmsg+console
|
||||
StandardError=kmsg+console
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
- name: install-open-vm-tools.service
|
||||
enabled: true
|
||||
contents: |
|
||||
[Unit]
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Before=systemd-user-sessions.service
|
||||
OnFailure=emergency.target
|
||||
OnFailureJobMode=replace-irreversibly
|
||||
ConditionPathExists=!/var/lib/open-vm-tools-installed
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/install-open-vm-tools
|
||||
ExecStartPost=/usr/bin/touch /var/lib/open-vm-tools-installed
|
||||
ExecStartPost=/usr/bin/systemctl --no-block reboot
|
||||
StandardOutput=kmsg+console
|
||||
StandardError=kmsg+console
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
storage:
|
||||
files:
|
||||
- path: /usr/local/bin/run-k3s-prereq-installer
|
||||
mode: 0755
|
||||
contents:
|
||||
inline: |
|
||||
#!/usr/bin/env sh
|
||||
main() {
|
||||
rpm-ostree install https://github.com/k3s-io/k3s-selinux/releases/download/v1.4.stable.1/k3s-selinux-1.4-1.coreos.noarch.rpm
|
||||
return 0
|
||||
}
|
||||
main
|
||||
- path: /etc/hostname
|
||||
mode: 0644
|
||||
contents:
|
||||
inline: |
|
||||
k3s-1
|
||||
- path: /etc/NetworkManager/system-connections/ens192.nmconnection
|
||||
mode: 0600
|
||||
contents:
|
||||
inline: |
|
||||
[connection]
|
||||
id=ens192
|
||||
type=ethernet
|
||||
interface-name=ens192
|
||||
[ipv4]
|
||||
address1=10.3.4.11SEDipSED/24,10.2.4.1
|
||||
dns=10.2.4.1;
|
||||
dns-search=example.com
|
||||
may-fail=false
|
||||
method=manual
|
||||
- path: /usr/local/bin/run-k3s-installer
|
||||
mode: 0755
|
||||
contents:
|
||||
inline: |
|
||||
#!/usr/bin/env sh
|
||||
main() {
|
||||
export K3S_KUBECONFIG_MODE="644"
|
||||
export K3S_URL="https://10.2.4.111:6443" K3S_TOKEN="SEDtokenSED"
|
||||
curl -sfL https://get.k3s.io | sh -
|
||||
return 0
|
||||
}
|
||||
main
|
||||
- path: /etc/rancher/k3s/kubelet.config
|
||||
mode: 0644
|
||||
contents:
|
||||
inline: |
|
||||
apiVersion: kubelet.config.k8s.io/v1beta1
|
||||
kind: KubeletConfiguration
|
||||
shutdownGracePeriod: 60s
|
||||
shutdownGracePeriodCriticalPods: 10s
|
||||
- path: /usr/local/bin/install-open-vm-tools
|
||||
mode: 0755
|
||||
contents:
|
||||
inline: |
|
||||
#!/usr/bin/env sh
|
||||
main() {
|
||||
while [ ! -f /var/lib/k3s-installed ] ; do
|
||||
sleep 2
|
||||
done
|
||||
rpm-ostree install open-vm-tools
|
||||
return 0
|
||||
}
|
||||
main
|
||||
passwd:
|
||||
users:
|
||||
- name: core
|
||||
password_hash: ""
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAEvf7cRxXo3dCYwLU0cxbxSgD4FabfYA2UFeZv1fwo7 akosfred
|
||||
|
||||
Reference in New Issue
Block a user