From 78912a879efd0deb30a618d0ae885a96808497b9 Mon Sep 17 00:00:00 2001 From: Sulaimanhameed Date: Thu, 13 Nov 2025 15:53:07 +0530 Subject: [PATCH 1/3] [CR-1113][Update]-Updated calico,kubernetes version --- settings.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.yaml b/settings.yaml index 2acb7f6..cbaad98 100644 --- a/settings.yaml +++ b/settings.yaml @@ -31,9 +31,9 @@ nodes: # vm_path: /vagrant/images software: box: bento/ubuntu-24.04 - calico: 3.26.0 + calico: 3.31.0 # To skip the dashboard installation, set its version to an empty value or comment it out: dashboard: 2.7.0 - kubernetes: 1.31.0-* + kubernetes: 1.34.0-* os: xUbuntu_24.04 From 78f0ede65d32fd42cdbe11e8bcb5cf9f05feba43 Mon Sep 17 00:00:00 2001 From: Sulaimanhameed Date: Fri, 14 Nov 2025 17:09:40 +0530 Subject: [PATCH 2/3] [CR-1113][Update]-update k8s dashboard version --- README.md | 11 ++---- scripts/dashboard.sh | 94 +++++++++++++++++++++++++++++++++----------- settings.yaml | 2 +- 3 files changed, 77 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 4b94b28..4e3b8b6 100644 --- a/README.md +++ b/README.md @@ -116,19 +116,16 @@ vagrant ssh -c "/vagrant/scripts/dashboard.sh" controlplane ## Kubernetes Dashboard Access -To get the login token, copy it from _config/token_ or run the following command: -```shell -kubectl -n kubernetes-dashboard get secret/admin-user -o go-template="{{.data.token | base64decode}}" -``` +To get the login token, copy it from _config/token -Make the dashboard accessible: +Port forward: ```shell -kubectl proxy +kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443 ``` Open the site in your browser: ```shell -http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login +https://localhost:8443 ``` ## To shutdown the cluster, diff --git a/scripts/dashboard.sh b/scripts/dashboard.sh index 5e5ef7a..33142cf 100755 --- a/scripts/dashboard.sh +++ b/scripts/dashboard.sh @@ -1,21 +1,52 @@ #!/bin/bash # -# Deploys the Kubernetes dashboard when enabled in settings.yaml +# Deploys the Kubernetes dashboard using Helm with NodePort when enabled in settings.yaml set -euxo pipefail config_path="/vagrant/configs" DASHBOARD_VERSION=$(grep -E '^\s*dashboard:' /vagrant/settings.yaml | sed -E -e 's/[^:]+: *//' -e 's/\r$//') + if [ -n "${DASHBOARD_VERSION}" ]; then + # Wait for metrics server to be ready while sudo -i -u vagrant kubectl get pods -A -l k8s-app=metrics-server | awk 'split($3, a, "/") && a[1] != a[2] { print $0; }' | grep -v "RESTARTS"; do echo 'Waiting for metrics server to be ready...' sleep 5 done echo 'Metrics server is ready. Installing dashboard...' - sudo -i -u vagrant kubectl create namespace kubernetes-dashboard + # Install Helm if not already installed + if ! command -v helm &> /dev/null; then + echo "Installing Helm..." + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + fi + + # Add the Kubernetes Dashboard Helm repository + echo "Adding Kubernetes Dashboard Helm repository..." + sudo -i -u vagrant helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ + sudo -i -u vagrant helm repo update + + # Install/upgrade the Kubernetes Dashboard with NodePort on 30443 for HTTPS + echo "Installing Kubernetes Dashboard version ${DASHBOARD_VERSION} with NodePort..." + sudo -i -u vagrant helm upgrade --install kubernetes-dashboard \ + kubernetes-dashboard/kubernetes-dashboard \ + --create-namespace \ + --namespace kubernetes-dashboard \ + --version "${DASHBOARD_VERSION}" \ + --set kong.proxy.type=NodePort \ + --set kong.proxy.https.enabled=true \ + --set kong.proxy.https.nodePort=30443 \ + --set kong.proxy.http.enabled=false + + # Wait for dashboard to be ready + echo "Waiting for dashboard pods to be ready..." + sudo -i -u vagrant kubectl wait --for=condition=ready pod \ + -l app.kubernetes.io/instance=kubernetes-dashboard \ + -n kubernetes-dashboard \ + --timeout=300s + # Create admin user for dashboard access echo "Creating the dashboard user..." cat < "${config_path}/token" + + # Get the control plane IP + CONTROL_IP=$(grep -E '^\s*control_ip:' /vagrant/settings.yaml | sed -E -e 's/[^:]+: *//' -e 's/\r$//') - sudo -i -u vagrant kubectl -n kubernetes-dashboard get secret/admin-user -o go-template="{{.data.token | base64decode}}" >> "${config_path}/token" - echo "The following token was also saved to: configs/token" + echo "" + echo "================================================================" + echo "Kubernetes Dashboard installed successfully!" + echo "================================================================" + echo "" + echo "Access Token (saved to configs/token):" cat "${config_path}/token" - echo " -Use it to log in at: -http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/overview?namespace=kubernetes-dashboard -" -fi + echo "" + echo "================================================================" + echo "Dashboard Access URL:" + echo "================================================================" + echo "" + echo " https://${CONTROL_IP}:30443" + echo "" + echo "================================================================" + echo "Login Instructions:" + echo "================================================================" + echo "1. Open your browser and navigate to: https://${CONTROL_IP}:30443" + echo "2. Accept the self-signed certificate warning:" + echo " - Click 'Advanced' or 'Show Details'" + echo " - Click 'Proceed to ${CONTROL_IP} (unsafe)' or 'Accept Risk'" + echo "3. On the login page, select 'Token' authentication method" + echo "4. Paste the token shown above (or from configs/token file)" + echo "5. Click 'Sign in'" + echo "" + echo "Note: The token is valid for 10 years (87600 hours)" + echo "" + echo "If you need a new token, run:" + echo " kubectl -n kubernetes-dashboard create token admin-user --duration=87600h" + echo "================================================================" +fi \ No newline at end of file diff --git a/settings.yaml b/settings.yaml index cbaad98..355f5be 100644 --- a/settings.yaml +++ b/settings.yaml @@ -33,7 +33,7 @@ software: box: bento/ubuntu-24.04 calico: 3.31.0 # To skip the dashboard installation, set its version to an empty value or comment it out: - dashboard: 2.7.0 + dashboard: 7.14.0 kubernetes: 1.34.0-* os: xUbuntu_24.04 From 316cd58f44bc75f4b2cc2a8289983d86e5447d57 Mon Sep 17 00:00:00 2001 From: Sulaimanhameed Date: Fri, 14 Nov 2025 18:56:57 +0530 Subject: [PATCH 3/3] [CR-1113][Update]-update k8s dashboard script --- scripts/dashboard.sh | 60 ++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 44 deletions(-) diff --git a/scripts/dashboard.sh b/scripts/dashboard.sh index 33142cf..5690500 100755 --- a/scripts/dashboard.sh +++ b/scripts/dashboard.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Deploys the Kubernetes dashboard using Helm with NodePort when enabled in settings.yaml +# Deploys the Kubernetes dashboard using Helm when enabled in settings.yaml set -euxo pipefail @@ -10,34 +10,30 @@ DASHBOARD_VERSION=$(grep -E '^\s*dashboard:' /vagrant/settings.yaml | sed -E -e if [ -n "${DASHBOARD_VERSION}" ]; then # Wait for metrics server to be ready - while sudo -i -u vagrant kubectl get pods -A -l k8s-app=metrics-server | awk 'split($3, a, "/") && a[1] != a[2] { print $0; }' | grep -v "RESTARTS"; do + while sudo -i -u vagrant kubectl get pods -A -l k8s-app=metrics-server | \ + awk 'split($3, a, "/") && a[1] != a[2] { print $0; }' | grep -v "RESTARTS"; do echo 'Waiting for metrics server to be ready...' sleep 5 done + echo 'Metrics server is ready. Installing dashboard...' - # Install Helm if not already installed - if ! command -v helm &> /dev/null; then - echo "Installing Helm..." - curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash - fi + # Install Helm + echo "Installing Helm..." + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash # Add the Kubernetes Dashboard Helm repository echo "Adding Kubernetes Dashboard Helm repository..." sudo -i -u vagrant helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ sudo -i -u vagrant helm repo update - # Install/upgrade the Kubernetes Dashboard with NodePort on 30443 for HTTPS - echo "Installing Kubernetes Dashboard version ${DASHBOARD_VERSION} with NodePort..." + # Install/upgrade the Kubernetes Dashboard + echo "Installing Kubernetes Dashboard version ${DASHBOARD_VERSION}..." sudo -i -u vagrant helm upgrade --install kubernetes-dashboard \ kubernetes-dashboard/kubernetes-dashboard \ --create-namespace \ --namespace kubernetes-dashboard \ - --version "${DASHBOARD_VERSION}" \ - --set kong.proxy.type=NodePort \ - --set kong.proxy.https.enabled=true \ - --set kong.proxy.https.nodePort=30443 \ - --set kong.proxy.http.enabled=false + --version "${DASHBOARD_VERSION}" # Wait for dashboard to be ready echo "Waiting for dashboard pods to be ready..." @@ -46,8 +42,8 @@ if [ -n "${DASHBOARD_VERSION}" ]; then -n kubernetes-dashboard \ --timeout=300s - # Create admin user for dashboard access - echo "Creating the dashboard user..." + # Create admin user + echo "Creating the dashboard admin user..." cat < "${config_path}/token" # Get the control plane IP CONTROL_IP=$(grep -E '^\s*control_ip:' /vagrant/settings.yaml | sed -E -e 's/[^:]+: *//' -e 's/\r$//') - echo "" - echo "================================================================" echo "Kubernetes Dashboard installed successfully!" - echo "================================================================" - echo "" + echo "Access Token (saved to configs/token):" cat "${config_path}/token" - echo "" - echo "================================================================" + echo "Dashboard Access URL:" - echo "================================================================" - echo "" echo " https://${CONTROL_IP}:30443" - echo "" - echo "================================================================" - echo "Login Instructions:" - echo "================================================================" - echo "1. Open your browser and navigate to: https://${CONTROL_IP}:30443" - echo "2. Accept the self-signed certificate warning:" - echo " - Click 'Advanced' or 'Show Details'" - echo " - Click 'Proceed to ${CONTROL_IP} (unsafe)' or 'Accept Risk'" - echo "3. On the login page, select 'Token' authentication method" - echo "4. Paste the token shown above (or from configs/token file)" - echo "5. Click 'Sign in'" - echo "" - echo "Note: The token is valid for 10 years (87600 hours)" - echo "" - echo "If you need a new token, run:" - echo " kubectl -n kubernetes-dashboard create token admin-user --duration=87600h" - echo "================================================================" -fi \ No newline at end of file +fi