galexrt / k8s-vagrant-multi-node

A Kubernetes Vagrant Multi node environment using kubeadm.
https://k8s-vagrant-multi-node.galexrt.moe/
Apache License 2.0
166 stars 81 forks source link

tr: Illegal byte sequence #2

Closed jbw976 closed 6 years ago

jbw976 commented 6 years ago

When running commit https://github.com/galexrt/k8s-vagrant-multi-node/commit/27c330475e6643a90d67ccd254b14f5c77dff23c on my Mac, I see the following messages from tr as the first output of make up. The installation completes and the Kubernetes cluster seems functional, so this may not be a big issue.

jared@Jareds-MacBook-Pro ~/dev/k8s-vagrant-multi-node (master)
> make up -j4
tr: Illegal byte sequence
tr: Illegal byte sequence
vagrant up
VAGRANT_VAGRANTFILE=Vagrantfile_nodes NODE=1 vagrant up
VAGRANT_VAGRANTFILE=Vagrantfile_nodes NODE=2 vagrant up
Bringing machine 'node1' up with 'virtualbox' provider...
Bringing machine 'node2' up with 'virtualbox' provider...
Bringing machine 'master' up with 'virtualbox' provider...
...
galexrt commented 6 years ago

@jbw976 Could you check if 6a1720d77ef9021daf8f9110fb45e8fa72687d5f fixed these tr error messages?

jbw976 commented 6 years ago

Seems to work OK now:

> make token
> cat .vagrant/KUBETOKEN
lgypb9.19zafgyfcgk5678o
galexrt commented 6 years ago

Thanks for verifying! That is the "correct" output now. Fix is now in master will tag it soon.

damianoneill commented 5 years ago

I'm see similar issue with current master / head

commit e65032e881877d39dbd652561f6ec061fc5f2241 (HEAD -> master, origin/master, origin/HEAD)
Author: Alexander Trost <galexrt@googlemail.com>
Date:   Mon Mar 4 18:36:33 2019 +0100

    Removed mentions of unused vagrant-plugin-vagrant-reload plugin

    Use Google DNS servers for Ubuntu as the "default" ones are sometimes
    broken causing the whole environment install to fail.

    Signed-off-by: Alexander Trost <galexrt@googlemail.com>

Using vagrant version;

$ vagrant version
Installed Version: 2.2.4
Latest Version: 2.2.4

You're running an up-to-date version of Vagrant!

Running the following command.

$ NODE_MEMORY_SIZE_GB=3 NODE_CPUS=2 NODE_COUNT=3 make up -j4
tr: Illegal byte sequence
tr: Illegal byte sequence
tr: Illegal byte sequence
tr: Illegal byte sequence
if !(vagrant box list | grep -q generic/fedora29); then \
        vagrant \
            box \
            add \
            --provider=virtualbox \
            generic/fedora29; \
    else \
        vagrant box update --box=generic/fedora29; \
    fi
==> box: Loading metadata for box 'generic/fedora29'
    box: URL: https://vagrantcloud.com/generic/fedora29

Host info

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.6
BuildVersion:   16G1815
damianoneill commented 5 years ago

@galexrt on my specific version of OSX the issue can be fixed by using LC_ALL rather than LC_CTYPE, see below.

Also note in the makefile there is an if statement that is being written to console, added an @ to silence.

$ git diff
diff --git a/Makefile b/Makefile
index 94ce364..a9ade67 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,7 @@ token: ## Generate a kubeadm join token, if needed (token file is `DIRECTORY_OF_
        fi
        @if [ ! -f "$(MFILECWD)/.vagrant/KUBETOKEN" ]; then \
                if [ -z "$(KUBETOKEN)" ]; then \
-                       echo "$(shell LC_CTYPE=C tr -cd 'a-z0-9' < /dev/urandom | fold -w 6 | head -n 1).$(shell cat /dev/urandom | LC_CTYPE=C tr -cd 'a-z0-9' < /dev/urandom | fold -w 16 | head -n 1)" > "$(MFILECWD)/.vagrant/KUBETOKEN"; \
+                       echo "$(shell LC_ALL=C tr -cd 'a-z0-9' < /dev/urandom | fold -w 6 | head -n 1).$(shell cat /dev/urandom | LC_ALL=C tr -cd 'a-z0-9' < /dev/urandom | fold -w 16 | head -n 1)" > "$(MFILECWD)/.vagrant/KUBETOKEN"; \
                else \
                        echo "$(KUBETOKEN)" > "$(MFILECWD)/.vagrant/KUBETOKEN"; \
                fi; \
@@ -119,7 +119,7 @@ kubectl: ## Configure kubeconfig context for the cluster using `kubectl config`
        @echo

 pull: ## Add and download, or update the box image on the host.
-       if !(vagrant box list | grep -q $(shell grep "^\$$box_image.*=.*'.*'\.freeze" "$(MFILECWD)/vagrantfiles/$(BOX_OS)/common" | cut -d\' -f2)); then \
+       @if !(vagrant box list | grep -q $(shell grep "^\$$box_image.*=.*'.*'\.freeze" "$(MFILECWD)/vagrantfiles/$(BOX_OS)/common" | cut -d\' -f2)); then \
                vagrant \
                        box \
                        add \
galexrt commented 5 years ago

@damianoneill I see, thanks for debugging this!

Do you want to open a PR with this fix?

damianoneill commented 5 years ago

@galexrt see #36