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

Replace fixed time wait with wait function for docker-env cmd #10021

Conversation

azhao155
Copy link
Contributor

fixes #9938

In docker-env, instead of waiting for 5s for api server to be up, wait for api server pid to show up.

Start minikube:
zyanshu@zyanshukvm:~/minikube$ ./out/minikube start -p p1
😄 [p1] minikube v1.16.0-beta.0 on Debian rodete
▪ MINIKUBE_ACTIVE_DOCKERD=p1
✨ Automatically selected the docker driver
👍 Starting control plane node p1 in cluster p1
🚜 Pulling base image ...
💾 Downloading Kubernetes v1.20.0 preload ...

preloaded-images-k8s-v7-v1....: 490.47 MiB / 490.47 MiB 100.00% 36.11 Mi
🔥 Creating docker container (CPUs=2, Memory=26100MB) ...
🐳 Preparing Kubernetes v1.20.0 on Docker 20.10.0 ...
🔎 Verifying Kubernetes components...
🌟 Enabled addons: storage-provisioner, default-storageclass
🏄 Done! kubectl is now configured to use "p1" cluster and "default" namespace by default

Run docker-env cmd:
zyanshu@zyanshukvm:~/minikube$ ./out/minikube docker-env -p p1 --alsologtostderr
I1216 09:02:56.000487 2711966 out.go:221] Setting OutFile to fd 1 ...
I1216 09:02:56.000826 2711966 out.go:273] isatty.IsTerminal(1) = true
I1216 09:02:56.000848 2711966 out.go:234] Setting ErrFile to fd 2...
I1216 09:02:56.000898 2711966 out.go:273] isatty.IsTerminal(2) = true
I1216 09:02:56.001040 2711966 root.go:279] Updating PATH: /usr/local/google/home/zyanshu/.minikube/bin
I1216 09:02:56.001095 2711966 oci.go:526] shell is pointing to dockerd inside minikube. will unset to use host
I1216 09:02:56.001425 2711966 mustload.go:66] Loading cluster: p1
I1216 09:02:56.002362 2711966 cli_runner.go:111] Run: docker container inspect p1 --format={{.State.Status}}
I1216 09:02:56.063844 2711966 host.go:66] Checking if "p1" exists ...
W1216 09:02:56.064205 2711966 docker-env.go:193] dockerd is not active will try to reload it...
I1216 09:02:56.064821 2711966 ssh_runner.go:148] Run: systemctl --version
I1216 09:02:56.064922 2711966 cli_runner.go:111] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" p1
I1216 09:02:56.123186 2711966 sshutil.go:45] new ssh client: &{IP:127.0.0.1 Port:33563 SSHKeyPath:/usr/local/google/home/zyanshu/.minikube/machines/p1/id_rsa Username:docker}
I1216 09:02:56.225523 2711966 ssh_runner.go:148] Run: sudo systemctl daemon-reload
I1216 09:02:56.399247 2711966 ssh_runner.go:148] Run: sudo systemctl reload docker
W1216 09:02:56.419070 2711966 docker-env.go:195] will try to restart dockerd because reload failed: sudo systemctl reload docker: Process exited with status 1
stdout:

stderr:
Job for docker.service failed.
See "systemctl status docker.service" and "journalctl -xe" for details.
I1216 09:02:56.419193 2711966 ssh_runner.go:148] Run: sudo systemctl daemon-reload
I1216 09:02:56.565812 2711966 ssh_runner.go:148] Run: sudo systemctl restart docker
I1216 09:02:57.949276 2711966 ssh_runner.go:188] Completed: sudo systemctl restart docker: (1.383387846s)
W1216 09:02:57.949350 2711966 docker-env.go:202] waiting to ensure apisever container is up...
I1216 09:02:57.949366 2711966 docker-env.go:209] waiting for apiserver process to appear ...
I1216 09:02:57.949446 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:02:58.467167 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:02:58.967199 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:02:59.467186 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:02:59.967177 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:03:00.467170 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:03:00.967182 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:03:01.039794 2711966 docker-env.go:229] duration metric: took 3.090415908s to wait for apiserver process to appear ...
I1216 09:03:01.039925 2711966 cli_runner.go:111] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" p1
I1216 09:03:01.097569 2711966 docker-env.go:459] Testing Docker connectivity with: /usr/bin/docker version --format={{.Server}}
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.49.2:2376"
export DOCKER_CERT_PATH="/usr/local/google/home/zyanshu/.minikube/certs"
export MINIKUBE_ACTIVE_DOCKERD="p1"

To point your shell to minikube's docker-daemon, run:
eval $(minikube -p p1 docker-env)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 21, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @azhao155. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 21, 2020
@azhao155
Copy link
Contributor Author

@medyagh

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@azhao155 azhao155 changed the title Yzhao/feature/docker env wait for api server fix commits Replace fixed time wait with wait function for docker-env cmd Dec 21, 2020
cmd/minikube/cmd/docker-env.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/docker-env.go Outdated Show resolved Hide resolved
@medyagh medyagh merged commit 167b6c4 into kubernetes:master Dec 22, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: azhao155, medyagh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify Apiserver in docker-env
4 participants