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

Created on 13 Sep 2017  路  8Comments  路  Source: kubernetes/minikube

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.

kinbug lifecyclrotten

All 8 comments

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
 卤 

This is a result of moving over to using the "SSHRunner" which uses the native go ssh library rather than the libmachine ssh library
https://github.com/kubernetes/minikube/pull/1844

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

I ran into this today while trying to automate the upload of an audit-policy-yaml file to /etc/kubernetes/audit-policy.yaml (see https://github.com/kubernetes/minikube/issues/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.

2110 will help

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

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

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

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)
Was this page helpful?
0 / 5 - 0 ratings