Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

minikube status command - always gets an error #1

Closed
kurtfm opened this issue Dec 3, 2021 · 3 comments
Closed

minikube status command - always gets an error #1

kurtfm opened this issue Dec 3, 2021 · 3 comments

Comments

@kurtfm
Copy link

kurtfm commented Dec 3, 2021

With the latest minikube on macOS this always gets an errror... even with a valid standard output.

    execSync("minikube status -o json", {
        encoding: "utf-8",
    });
};

If I console out the error...

    at checkExecSyncError (node:child_process:826:11)
    at execSync (node:child_process:900:15)
    at checkMinikubeStatus (file:///Users/kurtmoeller/Develop/node-minikube-docker-port-mapper/lib/minikube.js:8:18)
    at main (file:///Users/kurtmoeller/Develop/node-minikube-docker-port-mapper/index.js:22:5)
    at file:///Users/kurtmoeller/Develop/node-minikube-docker-port-mapper/index.js:50:1
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12) {
  status: 2,
  signal: null,
  output: [
    null,
    '{"Name":"minikube","Host":"Running","Kubelet":"Stopped","APIServer":"Stopped","Kubeconfig":"Configured","Worker":false,"DockerEnv":"in-use"}',
    ''
  ],
  pid: 66139,
  stdout: '{"Name":"minikube","Host":"Running","Kubelet":"Stopped","APIServer":"Stopped","Kubeconfig":"Configured","Worker":false,"DockerEnv":"in-use"}',
  stderr: ''
}

I suspect this is how minikube is returning a status:2 ... this gets interpreted as an error by execSync. It looks like you are just running the command to see if it hits an exception or not... if it does you move forward. I updated a local version to catch this exception and verify that I got some of the minikube output .... I am not super familiar with minikube but I think this should indicate it's ok to continue.

export const checkMinikubeStatus = () => {
    try {
        execSync("minikube status -o json", { encoding: "utf-8" });
    } catch (error) {
        const output = JSON.parse(error.stdout);
        if (error.stderr === '' && output['Host'] === 'Running') {
            return;
        } else {
            throw err(error);
        }
    }
}

After this change it will move on and configure the proxies. I considered just disabling the check... I figure if it's getting an IP back, that is probably good enough.

@fardjad
Copy link
Owner

fardjad commented Dec 3, 2021

Minikube should not return a non-zero status code. I think your problem might be related to the following issue:

kubernetes/minikube#9976

@kurtfm
Copy link
Author

kurtfm commented Dec 3, 2021

Thanks for your reply... I don't think it's the same issue as 9976 (related to symlink of kubectl), but the process is exiting with some kind of status/error. I am not all that familiar with minikube, but I used the --alsologtostderr and it looks like it may be getting errors because the API server is down. I am starting it up with the --no-kubernetes flag... not sure if you have tried that.

@fardjad
Copy link
Owner

fardjad commented Dec 3, 2021

Since I couldn't reproduce the issue, I replaced the status check with an attempt to get an IP address. I think that should solve your issue as well.

@fardjad fardjad closed this as completed Dec 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants