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

minikube ssh doesn't recognize the end of transmission signal from standard input #1957

Closed
pbochynski opened this issue Sep 13, 2017 · 8 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@pbochynski
Copy link

pbochynski commented Sep 13, 2017

Is this a BUG REPORT or FEATURE REQUEST? (choose one): bug

Environment:

Minikube version (use minikube version): 0.22.0 & 0.22.1

  • OS (e.g. from /etc/os-release): mac OS 10.12.6
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName): xhyve
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION): testing
  • Install tools:
  • Others:

What happened:
I have a script that copies some files to minikube machine. In general it is something like this:

cat | minikube ssh "cat"

It worked with minikube 0.21.0. With 0.22.0 and 0.22.1 the ssh command waits for the end of input stream forever. It doesn't recognize that the file was already transmitted. The same happens with standard input.

What you expected to happen:

I expect that the minikube ssh process will exit after end of the transmission (Ctrl+D)

How to reproduce it (as minimally and precisely as possible):

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.22.0/minikube-darwin-amd64 &&  chmod +x minikube && sudo mv minikube /usr/local/bin/

$ minikube delete
$ sudo rm -Rf ~/.minikube
$ minikube config set kubernetes-version v1.7.5
$ minikube start  --vm-driver=xhyve

$ cat | minikube ssh "cat"

Write couple of characters and type Ctrl+D. Nothing happens.
If you change version to 0.21.0 then after Ctrl+D command is finished.

@pbochynski pbochynski changed the title minikube ssh doesn't recognize end of transmission from standard input minikube ssh doesn't recognize the end of transmission signal from standard input Sep 13, 2017
@r2d4 r2d4 added the kind/bug Categorizes issue or PR as related to a bug. label Sep 14, 2017
@zakame
Copy link
Contributor

zakame commented Nov 1, 2017

Can replicate even on minikube 0.23, as I cannot use docker save | minikube ssh docker load pattern:

 ± docker save perl:5.26 | minikube ssh docker load                  
requested load from stdin, but stdin is empty
 ± 

@r2d4
Copy link
Contributor

r2d4 commented Nov 1, 2017

This is a result of moving over to using the "SSHRunner" which uses the native go ssh library rather than the libmachine ssh library
#1844

I'll have to investigate exactly what was added in the libmachine ssh library to capture the signal.

@wallrj
Copy link
Contributor

wallrj commented Nov 10, 2017

I ran into this today while trying to automate the upload of an audit-policy-yaml file to /etc/kubernetes/audit-policy.yaml (see #1609)

Instead I've resorted to base64 encoding the file content and supplying it as a command line argument.

AUDIT_POLICY_FILE_PATH="/etc/kubernetes/audit-policy.yaml"
AUDIT_POLICY_FILE_CONTENT=$(cat <<EOF
# Log all requests at the Metadata level.
apiVersion: audit.k8s.io/v1beta1
kind: Policy
rules:
- level: Metadata
EOF
)

minikube start \
         --vm-driver kvm \
         --extra-config=apiserver.Authorization.Mode=RBAC \
         --extra-config=apiserver.Audit.LogOptions.Path=/var/log/apiserver/audit.log \
         --extra-config=apiserver.Audit.PolicyFile="${AUDIT_POLICY_FILE_PATH}" \
         -v 6

function upload_file() {
    local path="${1}"
    local content="$(base64 --wrap=0 <<<${2})"
    local sudo="${3}"
    if minikube ssh \
                -- \
                "base64 --decode - <<<${content} | ${sudo} tee ${path}"
    then
        return 0
    fi
    return 1
}

while ! upload_file \
        "${AUDIT_POLICY_FILE_PATH}" \
        "${AUDIT_POLICY_FILE_CONTENT}" \
        "sudo" ; do
      sleep 10
done

It would be good to have a way to upload files to minikube VM before it starts localkube.

@r2d4
Copy link
Contributor

r2d4 commented Nov 10, 2017

#2110 will help

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 8, 2018
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 10, 2018
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@piotrminkina
Copy link

Can replicate even on minikube 0.23, as I cannot use docker save | minikube ssh docker load pattern:

@zakame Try this:

docker save perl:5.26 | (eval `minikube docker-env`; docker load)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

7 participants