techiescamp / vagrant-kubeadm-kubernetes

Vagrantfile & Scripts to setup Kubernetes Cluster using Kubeadm for CKA, CKAD and CKS practice environment
https://devopscube.com/kubernetes-cluster-vagrant/
GNU General Public License v3.0
662 stars 672 forks source link

Vagrant up fails when applying dashboard #44

Closed elico closed 6 months ago

elico commented 1 year ago

The "DASHBOARD_VERSION" determined by: https://github.com/techiescamp/vagrant-kubeadm-kubernetes/blob/main/scripts/dashboard.sh#L9

is including a return "\r" character and it blocks the installation scripts.

    node01: + sudo -i -u vagrant kubectl apply -f $'https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0\r/aio/deploy/recommended.yaml'
    node01: error: the URL passed to filename "https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0\r/aio/deploy/recommended.yaml" is not valid: parse "https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0\r/aio/deploy/recommended.yaml": net/url: invalid control character in URL
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
eyonkerepwed commented 1 year ago

Sam issues here @elico am facing. i check this url[https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0\r/aio/deploy/recommended.yaml] and its throwing 404 file not found. @bibinwilson, please what could go wrong here, we cant access the dashboard and stuck to finish the setup. here is the same error output: clusterrolebinding.rbac.authorization.k8s.io/admin-user created node01: Deploying the dashboard... node01: + echo 'Deploying the dashboard...' node01: + sudo -i -u vagrant kubectl apply -f $'https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0\r/aio/deploy/recommended.yaml' node01: error: the URL passed to filename "https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0\r/aio/deploy/recommended.yaml" is not valid: parse "https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0\r/aio/deploy/recommended.yaml": net/url: invalid control character in URL The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.

eyonkerepwed commented 1 year ago

@bibinwilson could it be that grep search here was supposed to be a / slash instead of a backslash:

DASHBOARD_VERSION=$(grep -E '^\sdashboard:' /vagrant/settings.yaml | sed -E 's/[^:]+: //')

lucasbalm commented 1 year ago

Suggestion: Replace the line from: DASHBOARD_VERSION=$(grep -E '^\sdashboard:' /vagrant/settings.yaml | sed -E 's/[^:]+: //') To: DASHBOARD_VERSION=$(grep -E '^\sdashboard:' /vagrant/settings.yaml | sed -E 's/[^:]+: //;s/\r//')

H2CO3Bearcard commented 1 year ago

DASHBOARD_VERSION=$(grep -E '^\s*dashboard:' /vagrant/settings.yaml | grep -E -o '[0-9.]+')

techiescamp commented 6 months ago

Fixed