Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Print logs of bootkube if it fails #440

Closed
invidian opened this issue May 19, 2020 · 0 comments · Fixed by #543
Closed

Print logs of bootkube if it fails #440

invidian opened this issue May 19, 2020 · 0 comments · Fixed by #543
Labels
kind/enhancement New feature or request

Comments

@invidian
Copy link
Member

To make provisioning debugging easier, we should be able to print the bootkube logs if it fails.

This could be done for example like this:

diff --git a/assets/lokomotive-kubernetes/aws/flatcar-linux/kubernetes/ssh.tf b/assets/lokomotive-kubernetes/aws/flatcar-linux/kubernetes/ssh.tf
index 58a4caaa..c87d7678 100644
--- a/assets/lokomotive-kubernetes/aws/flatcar-linux/kubernetes/ssh.tf
+++ b/assets/lokomotive-kubernetes/aws/flatcar-linux/kubernetes/ssh.tf
@@ -96,7 +96,7 @@ resource "null_resource" "bootkube-start" {
   provisioner "remote-exec" {
     inline = [
       "sudo mv $HOME/assets /opt/bootkube",
-      "sudo systemctl start bootkube",
+      "sudo systemctl start bootkube || (journalctl -u bootkube; exit 1)",
     ]
   }
 }
diff --git a/assets/lokomotive-kubernetes/bare-metal/flatcar-linux/kubernetes/ssh.tf b/assets/lokomotive-kubernetes/bare-metal/flatcar-linux/kubernetes/ssh.tf
index ace39f26..f61a5283 100644
--- a/assets/lokomotive-kubernetes/bare-metal/flatcar-linux/kubernetes/ssh.tf
+++ b/assets/lokomotive-kubernetes/bare-metal/flatcar-linux/kubernetes/ssh.tf
@@ -131,7 +131,7 @@ resource "null_resource" "bootkube-start" {
   provisioner "remote-exec" {
     inline = [
       "sudo mv $HOME/assets /opt/bootkube",
-      "sudo systemctl start bootkube",
+      "sudo systemctl start bootkube || (journalctl -u bootkube; exit 1)",
     ]
   }
 }
@invidian invidian added the kind/enhancement New feature or request label May 19, 2020
invidian added a commit that referenced this issue May 29, 2020
invidian added a commit that referenced this issue May 29, 2020
invidian added a commit that referenced this issue May 29, 2020
invidian added a commit that referenced this issue Jun 3, 2020
This reverts commit e852117.

This patch do not work, as Terraform does not print any losg of
remote-exec to the user.

Closes #440.
invidian added a commit that referenced this issue Jun 5, 2020
This reverts commit e852117.

This patch does not work, as Terraform does not print any logs of
remote-exec to the user.

Closes #440.
invidian added a commit that referenced this issue Nov 5, 2020
In previous attempt in e852117, I
missed the fact that Terraform remote-exec only prints stderr to the
user and stdout is ignored. This means, if we redirect journalctl output
to stderr, then it should be printed which will improve debugging
experience.

Refs #440

Signed-off-by: Mateusz Gozdek <[email protected]>
invidian added a commit that referenced this issue Nov 6, 2020
In previous attempt in e852117, I
missed the fact that Terraform remote-exec only prints stderr to the
user and stdout is ignored. This means, if we redirect journalctl output
to stderr, then it should be printed which will improve debugging
experience.

Refs #440

Signed-off-by: Mateusz Gozdek <[email protected]>
invidian added a commit that referenced this issue Nov 6, 2020
In previous attempt in e852117, I
missed the fact that Terraform remote-exec only prints stderr to the
user and stdout is ignored. This means, if we redirect journalctl output
to stderr, then it should be printed which will improve debugging
experience.

Refs #440

Signed-off-by: Mateusz Gozdek <[email protected]>
invidian added a commit that referenced this issue Nov 6, 2020
In previous attempt in e852117, I
missed the fact that Terraform remote-exec only prints stderr to the
user and stdout is ignored. This means, if we redirect journalctl output
to stderr, then it should be printed which will improve debugging
experience.

Refs #440

Signed-off-by: Mateusz Gozdek <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant