• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Access Kubernetes Dashboard Externally

By admin

Following is an alternative workaround to access Dashboard externally.

1. kubernetes-dashboard is a service file which provides dash-board functionality, to edit this we need to edit dashboard service and change service “type” from ClusterIP to NodePort:

[root@kubeXXXX]# kubectl -n kube-system edit service kubernetes-dashboard

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2018-05-08T15:03:48Z
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
resourceVersion: "1855185"
selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard
uid: 02c97f8b-52d1-11e8-a941-080027efcddc
spec:
clusterIP: 10.107.194.2xx
externalTrafficPolicy: Cluster
ports:
- nodePort: 32414
port: 443
protocol: TCP
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
sessionAffinity: None
type: NodePort                   ### clusterIP to NodePort
status:
loadBalancer: {}

2. Following command will give us mapped port to dash-board service

# kubectl -n kube-system get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.96.0.10 [none] 53/UDP,53/TCP 20d
kubernetes-dashboard NodePort 10.107.194.201 [none] 443:32414/TCP 20d
# lsof -i tcp:32414
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
kube-prox 3440 root 7u IPv6 32584 0t0 TCP *:32414 (LISTEN)

3. Execute following command to obtain token.

# kubectl -n kube-system describe $(kubectl -n kube-system get secret -n kube-system -o name | grep namespace) | grep token:   eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJuYW1lc3BhY2UtY29udHJvbGxlci10b2tlbi1wY21oNCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJuYW1lc3BhY2UtY29udHJvbGxlciIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImY1YmEyNDQ3LTUyZDAtMTFlOC1hOTQxLTA4MDAyN2VmY2RkYyIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTpuYW1lc3BhY2UtY29udHJvbGxlciJ9.Jvd6HJVBN9UEK8gzojed8TATpj6JycahZJ-qS5a66so3MEj_MIB3Vpy-MAPQErAL_DnSdvMVZA4gw5XSwK0ufYatA3lVP9sxUmc-eI1zd-HYF9UbvhtXaLuY-Wqx8kQ3_lKkqattFocQd8WswQY6SmrMthV5b8Xu3tNV3bpCaqZNhw6X8_-Yxh4Q4ATBoT0cXrO_WAYxFwd4_ilII_UPXYjs2ZSK7G2g0QJPtLyEKOXMtC7ZuAETc5MKdX_m4nC7CLSR-j5-7aG0gyd_vzwYiyewnLC4T-Byw9fVO8cpE0nswSxyGVX_QR9kIVHRT7QdLOkJEBARFpTyUczX9oETPw

4. Access dashborad using https://[master_node_ip]:[port] and provide token to sign-in.

Filed Under: DevOps, Kubernetes

Some more articles you might also be interested in …

  1. Unable to run NGINX Docker due to “13: Permission denied”
  2. How to Disable Docker Process and docker0 Interface on CentOS/RHEL
  3. How to Run Ad-Hoc Commands Using Ansible
  4. New User Failed Run Kubectl with Error “The connection to the server xxx.xxx.xxx was refused – did you specify the right host or port?”
  5. How to configure docker to use proxy
  6. How to use shell aliases in Linux
  7. How to write multiple plays and per-play privilege escalation in Ansible
  8. How to create Docker Image from a Container and Dockerfile
  9. How to Access Docker Container’s Network Namespace from Host
  10. How to Trace Python Scripts using trace.py

You May Also Like

Primary Sidebar

Recent Posts

  • Basics of client connectivity in Oracle Data Guard configuration
  • ORA-354 ORA-353 and ORA-312: Possible corruption in Online Redo Log File Members in a Redo Log Group
  • How to relocate the redo log files to a different location on disk
  • Oracle Database: Redo log operations (Add/Drop/Change Location)
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary