making k3s start more robust
This commit is contained in:
parent
c49a65308b
commit
e39dc064e2
@ -72,12 +72,14 @@ resource "hcloud_server" "agents" {
|
|||||||
inline = local.install_k3s_agent
|
inline = local.install_k3s_agent
|
||||||
}
|
}
|
||||||
|
|
||||||
# Upon reboot verify that k3s agent starts correctly
|
# Start the k3s agent and wait for it to have started
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
|
"systemctl start k3s-agent",
|
||||||
<<-EOT
|
<<-EOT
|
||||||
timeout 120 bash <<EOF
|
timeout 120 bash <<EOF
|
||||||
until systemctl status k3s-agent > /dev/null; do
|
until systemctl status k3s-agent > /dev/null; do
|
||||||
|
systemctl start k3s-agent
|
||||||
echo "Waiting for the k3s agent to start..."
|
echo "Waiting for the k3s agent to start..."
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
@ -87,6 +87,6 @@ udevadm settle
|
|||||||
|
|
||||||
install_k3s_server = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=server sh -"])
|
install_k3s_server = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=server sh -"])
|
||||||
|
|
||||||
install_k3s_agent = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_EXEC=agent sh -"])
|
install_k3s_agent = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=agent sh -"])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ resource "hcloud_server" "first_control_plane" {
|
|||||||
<<-EOT
|
<<-EOT
|
||||||
timeout 120 bash <<EOF
|
timeout 120 bash <<EOF
|
||||||
until systemctl status k3s > /dev/null; do
|
until systemctl status k3s > /dev/null; do
|
||||||
|
systemctl start k3s
|
||||||
echo "Waiting for the k3s server to start..."
|
echo "Waiting for the k3s server to start..."
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
@ -77,13 +77,14 @@ resource "hcloud_server" "control_planes" {
|
|||||||
inline = local.install_k3s_server
|
inline = local.install_k3s_server
|
||||||
}
|
}
|
||||||
|
|
||||||
# Upon reboot verify that the k3s server starts correctly
|
# Start the k3s server and wait for it to have started correctly
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"systemctl start k3s",
|
"systemctl start k3s",
|
||||||
<<-EOT
|
<<-EOT
|
||||||
timeout 120 bash <<EOF
|
timeout 120 bash <<EOF
|
||||||
until systemctl status k3s > /dev/null; do
|
until systemctl status k3s > /dev/null; do
|
||||||
|
systemctl start k3s
|
||||||
echo "Waiting for the k3s server to start..."
|
echo "Waiting for the k3s server to start..."
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user