Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - status command #304

Closed
gtirloni opened this issue Jun 14, 2017 · 5 comments
Closed

Feature Request - status command #304

gtirloni opened this issue Jun 14, 2017 · 5 comments

Comments

@gtirloni
Copy link

It would be nice to have a kubeadm status command that can be used to check if a host has been initialized already.

It seems the only way to do that right now is to run kubeadm init and let it fail in the pre-flight checks.

@pipejakob
Copy link
Contributor

Do you have a usecase for doing this programmatically? Or is it just for human interactions, where you might be playing around and forget the state of a machine?

One thing you can do today is test the cluster health using kubectl instead of kubeadm (since kubeadm is only targeting initialization of master and nodes):

$ kubectl get componentstatuses
NAME                 STATUS    MESSAGE              ERROR
controller-manager   Healthy   ok                   
scheduler            Healthy   ok                   
etcd-0               Healthy   {"health": "true"}   

This is what it looks like on host that hasn't been initialized:

$ kubectl get componentstatuses
The connection to the server localhost:8080 was refused - did you specify the right host or port?

This approach depends on having the KUBECONFIG environment variable set correctly and having proper permissions to the file before running kubectl, of course:

$ sudo -s
$ export KUBECONFIG=/etc/kubernetes/admin.conf 

@gtirloni
Copy link
Author

I was creating an Ansible playbook and at some point wanted to confirm that the host was 'clean' before proceeding with kubeadm init, just as a safety measure.

I think kubectl get componentstatuses could work in that case, thanks for the idea. For my use case, that should be enough.

@luxas
Copy link
Member

luxas commented Jun 15, 2017

Closing for now, we may want to revisit it at some point in the future, but I think for now kubectl get cs is good enough.

@luxas luxas closed this as completed Jun 15, 2017
@LSmyrnaios
Copy link

Hi, could you please re-consider implementing this kubeadm status command?
Today if I use the suggested "kubectl get cs" I get this weird output:

NAME                 AGE
scheduler            <unknown>
controller-manager   <unknown>
etcd-0               <unknown>

@MaKaNu
Copy link

MaKaNu commented Sep 23, 2024

I have the same situation as @gtirloni, and I don't know if kubectl get cs is fitting the job. If I have fresh installation of kubernetes, the command returns connection refused. At a first glance, this is ok, because we expect this and can trigger an ansible block command dependent. On the other hand, the command results with rc=1, which is not a good behavior if I want the status of kubernetes. So I would need to apply antipatterns like ignore_errors. If I want to know the status of a system, an error should in no situation the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants