Skip to content

Commit

Permalink
Try to get pod logs
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Nov 28, 2024
1 parent d4531f0 commit bcbecd8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/node/statusfunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ type statusEvents struct {
// kubectl get pods -o json
type podStatusList struct {
Items []struct {
Name string `json:"name"`
Metadata struct {
Name string `json:"name"`
} `json:"metadata"`
Status struct {
ContainerStatuses []struct {
ContainerID string `json:"containerID"`
Expand Down Expand Up @@ -149,13 +151,15 @@ func SystemPodsRunningFunc(h *cluster.Host) retryFunc {

for _, p := range pods.Items {
if p.Status.Phase != "Running" {
log.Debugf("%s: pod %s phase '%s'", h, p.Name, p.Status.Phase)
log.Debugf("%s: pod %s phase '%s'", h, p.Metadata.Name, p.Status.Phase)
continue
}
running++
for _, c := range p.Status.ContainerStatuses {
if !c.Ready {
log.Debugf("%s: container %s not ready %s (%s)", h, c.Name, c.State.Waiting.Reason, c.State.Waiting.Message)
_ = h.Exec(h.Configurer.KubectlCmdf(h, h.K0sDataDir(), "-n kube-system logs %s -c %s %s", p.Metadata.Name, c.Name), exec.Sudo(h))

continue
}
ready++
Expand Down

0 comments on commit bcbecd8

Please sign in to comment.