Skip to content

Commit 887317e

Browse files
committed
follow similar steps to legacy k8s dashboard and update access notes
1 parent 7db663b commit 887317e

File tree

2 files changed

+37
-56
lines changed

2 files changed

+37
-56
lines changed

scripts/util/create-kubernetes-binaries-iso.sh

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -102,55 +102,6 @@ echo "Downloading Headlamp manifest from ${HEADLAMP_DASHBOARD_URL}"
102102
headlamp_conf_file="${working_dir}/headlamp.yaml"
103103
curl -sSL ${HEADLAMP_DASHBOARD_URL} -o ${headlamp_conf_file}
104104

105-
# Patch the Headlamp manifest to add missing components
106-
echo "Patching Headlamp manifest with missing ServiceAccount and ClusterRoleBinding..."
107-
108-
if ! grep -q "kind: ServiceAccount" ${headlamp_conf_file}; then
109-
echo "Adding missing ServiceAccount to Headlamp manifest"
110-
cat > ${headlamp_conf_file}.tmp << 'EOF'
111-
---
112-
# ServiceAccount for Headlamp (added by CloudStack)
113-
kind: ServiceAccount
114-
apiVersion: v1
115-
metadata:
116-
name: headlamp-admin
117-
namespace: kube-system
118-
---
119-
# ClusterRoleBinding to grant cluster-admin permissions to Headlamp (added by CloudStack)
120-
kind: ClusterRoleBinding
121-
apiVersion: rbac.authorization.k8s.io/v1
122-
metadata:
123-
name: headlamp-admin
124-
roleRef:
125-
apiGroup: rbac.authorization.k8s.io
126-
kind: ClusterRole
127-
name: cluster-admin
128-
subjects:
129-
- kind: ServiceAccount
130-
name: headlamp-admin
131-
namespace: kube-system
132-
---
133-
EOF
134-
cat ${headlamp_conf_file} >> ${headlamp_conf_file}.tmp
135-
mv ${headlamp_conf_file}.tmp ${headlamp_conf_file}
136-
fi
137-
138-
if grep -q "kind: Deployment" ${headlamp_conf_file} && ! grep -q "serviceAccountName:" ${headlamp_conf_file}; then
139-
echo "Adding serviceAccountName to Headlamp Deployment"
140-
awk '/kind: Deployment/,0 {
141-
if (/^ spec:$/ && !found) {
142-
print
143-
print " serviceAccountName: headlamp-admin"
144-
found=1
145-
next
146-
}
147-
}
148-
{print}' ${headlamp_conf_file} > ${headlamp_conf_file}.tmp
149-
mv ${headlamp_conf_file}.tmp ${headlamp_conf_file}
150-
fi
151-
152-
echo "Headlamp manifest patched successfully"
153-
154105
# TODO : Change the url once merged
155106
AUTOSCALER_URL="https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/cloudstack/examples/cluster-autoscaler-standard.yaml"
156107
echo "Downloading kubernetes cluster autoscaler ${AUTOSCALER_URL}"

ui/src/views/compute/KubernetesServiceTab.vue

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,62 @@
6666
</a-timeline>
6767
</a-card>
6868
<a-card :title="$t('label.kubernetes.dashboard')">
69+
<p><strong>Note:</strong> CloudStack Kubernetes clusters use <strong>Headlamp</strong> dashboard (deployed in <code>kube-system</code> namespace). For backward compatibility with older clusters using Kubernetes Dashboard, please check your cluster configuration.</p>
6970
<a-timeline>
7071
<a-timeline-item>
7172
<p>
72-
{{ $t('label.run.proxy.locally') }}<br><br>
73-
<code><b>kubectl --kubeconfig /custom/path/kube.conf proxy</b></code>
73+
<strong>Access Headlamp Dashboard (new clusters)</strong><br><br>
74+
<strong>Step 1:</strong> Run port-forward command:<br>
75+
<code><b>kubectl --kubeconfig /custom/path/kube.conf port-forward -n kube-system service/headlamp 8080:80</b></code><br><br>
76+
<strong>Step 2:</strong> Open in your browser:<br>
77+
<a href="http://localhost:8080"><code>http://localhost:8080</code></a>
7478
</p>
7579
</a-timeline-item>
7680
<a-timeline-item>
7781
<p>
78-
{{ $t('label.open.url') }}<br><br>
82+
<strong>Access Kubernetes Dashboard (legacy clusters)</strong><br><br>
83+
<strong>Step 1:</strong> {{ $t('label.run.proxy.locally') }}<br>
84+
<code><b>kubectl --kubeconfig /custom/path/kube.conf proxy</b></code><br><br>
85+
<strong>Step 2:</strong> {{ $t('label.open.url') }}<br>
7986
<a href="http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/"><code>http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/</code></a>
8087
</p>
8188
</a-timeline-item>
8289
<a-timeline-item>
90+
<p>
91+
<strong>Create Access Token for Headlamp (new clusters)</strong>
92+
</p>
8393
<p v-html="$t('label.kubernetes.dashboard.create.token')"></p>
8494
<p v-html="$t('label.kubernetes.dashboard.create.token.desc')"></p>
85-
<a-textarea :value="'kubectl --kubeconfig /custom/path/kube.conf apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: kubernetes-dashboard-admin-user\n namespace: kubernetes-dashboard\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: kubernetes-dashboard-admin-user\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n name: kubernetes-dashboard-admin-user\n namespace: kubernetes-dashboard\n---\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n name: kubernetes-dashboard-token\n namespace: kubernetes-dashboard\n annotations:\n kubernetes.io/service-account.name: kubernetes-dashboard-admin-user\nEOF'" :rows="10" readonly />
95+
<a-textarea :value="'kubectl --kubeconfig /custom/path/kube.conf apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: headlamp-admin\n namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: headlamp-admin\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n name: headlamp-admin\n namespace: kube-system\n---\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n name: headlamp-admin-token\n namespace: kube-system\n annotations:\n kubernetes.io/service-account.name: headlamp-admin\nEOF'" :rows="12" readonly />
96+
<br><br>
97+
<p>{{ $t('label.token.for.dashboard.login') }}:</p>
98+
<code><b>kubectl --kubeconfig /custom/path/kube.conf describe secret headlamp-admin-token -n kube-system</b></code>
99+
</a-timeline-item>
100+
<a-timeline-item>
101+
<p>
102+
<strong>Create Access Token for Kubernetes Dashboard (legacy clusters)</strong>
103+
</p>
104+
<p v-html="$t('label.kubernetes.dashboard.create.token.desc')"></p>
105+
<a-textarea :value="'kubectl --kubeconfig /custom/path/kube.conf apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: kubernetes-dashboard-admin-user\n namespace: kubernetes-dashboard\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: kubernetes-dashboard-admin-user\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n name: kubernetes-dashboard-admin-user\n namespace: kubernetes-dashboard\n---\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n name: kubernetes-dashboard-token\n namespace: kubernetes-dashboard\n annotations:\n kubernetes.io/service-account.name: kubernetes-dashboard-admin-user\nEOF'" :rows="12" readonly />
106+
<br><br>
107+
<p>{{ $t('label.token.for.dashboard.login') }}:</p>
108+
<code><b>kubectl --kubeconfig /custom/path/kube.conf describe secret kubernetes-dashboard-token -n kubernetes-dashboard</b></code>
86109
</a-timeline-item>
87110
<a-timeline-item>
88111
<p>
89-
{{ $t('label.token.for.dashboard.login') }}<br><br>
90-
<code><b>kubectl --kubeconfig /custom/path/kube.conf describe secret $(kubectl --kubeconfig /custom/path/kube.conf get secrets -n kube-system | grep headlamp-admin | awk '{print $1}') -n kube-system</b></code>
112+
<strong>Important Notes:</strong><br>
113+
• <strong>Port-forwarding is recommended for Headlamp</strong> - simpler and more reliable than kubectl proxy<br>
114+
• Token is only needed if accessing Headlamp via NodePort or LoadBalancer with external access<br>
115+
• For Kubernetes 1.24+, service account tokens are no longer auto-generated - use the Secret resource shown above or <code>kubectl create token</code> command<br>
116+
• <strong>Cluster-admin role grants full control</strong> - use with caution and only for trusted administrators<br>
117+
• Keep the port-forward command running while using the dashboard (press Ctrl+C to stop)
91118
</p>
92119
</a-timeline-item>
93120
</a-timeline>
94-
<p>{{ $t('label.more.access.dashboard.ui') }}, <a href="https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/#accessing-the-dashboard-ui">https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/#accessing-the-dashboard-ui</a></p>
121+
<p>{{ $t('label.more.access.dashboard.ui') }}:
122+
<a href="https://headlamp.dev/docs/latest/">Headlamp Documentation</a> |
123+
<a href="https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/#accessing-the-dashboard-ui">Kubernetes Dashboard (Legacy)</a>
124+
</p>
95125
</a-card>
96126
<a-card :title="$t('label.access.kubernetes.nodes')">
97127
<p v-html="$t('label.kubernetes.access.details')"></p>

0 commit comments

Comments
 (0)