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

recover etcd: Remove kube-apiserver container to trigger immediate restart #97

Merged
merged 1 commit into from
Aug 14, 2018

Conversation

dlipovetsky
Copy link
Contributor

@dlipovetsky dlipovetsky commented Aug 14, 2018

Fixes #98

@dlipovetsky
Copy link
Contributor Author

Verified that kube-apiserver is immediately restarted by kubelet, and that it is healthy.

cmd/etcd.go Outdated
log.Printf("Warning: Unable to restart kubelet on machine %q: %v", mwc.Machine.Name, err)
log.Printf("[recover etcd] Removing kube-apiserver container on master %q to trigger immediate restart", mwc.Machine.Name)
if err := removeKubeAPIServerContainer(mwc.Client); err != nil {
log.Fatalf("Unable to remove kube-apiserver container on master %q: %v", mwc.Machine.Name, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Daniel, do we want to log fatal here or return the errr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixing.

cmd/etcd.go Outdated
if err != nil {
return "", fmt.Errorf("error running %q: %v (stdout: %q, stderr: %q)", cmd, err, string(stdOut), string(stdErr))
}
return string(stdOut), nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is trimming of the string, required as well here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes--without it there is a trailing newline. Fixing.

Copy link
Contributor

@puneetguptanitj puneetguptanitj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Daniel, thanks for fixing this, few small questions

@dlipovetsky dlipovetsky force-pushed the private/daniel/restart-kube-apiserver branch from 8fbda83 to 1d979d9 Compare August 14, 2018 05:00
@dlipovetsky
Copy link
Contributor Author

Squashed.

Copy link
Contributor

@sarun87 sarun87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this Daniel.


func identifyDockerContainer(filters []string, client sshmachine.Client) (string, error) {
filterFlags := buildDockerFilterFlags(filters)
cmd := fmt.Sprintf("docker ps --quiet %s", filterFlags)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to use docker inspect --format="{{.Id}}" contianer_name? Although I suppose it would be difficult to get the exact container name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the name includes UIDs that we can't derive.

@dlipovetsky dlipovetsky merged commit 58c23b6 into master Aug 14, 2018
@dlipovetsky dlipovetsky deleted the private/daniel/restart-kube-apiserver branch August 14, 2018 06:22
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

Successfully merging this pull request may close these issues.

4 participants