canonical / microk8s

MicroK8s is a small, fast, single-package Kubernetes for datacenters and the edge.
https://microk8s.io
Apache License 2.0
8.46k stars 771 forks source link

How to change dashboard / grafana login credentials? #389

Closed khteh closed 5 years ago

khteh commented 5 years ago

Please run microk8s.inspect and attach the generated tarball to this issue.

We appreciate your feedback. Thank you for using microk8s. https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy

It prompts for username/password....

khteh commented 5 years ago

Got it!

khteh commented 5 years ago

How to change the long crypted password to a customized one?

ktsakalozos commented 5 years ago

Right now this username/password are random strings created at MicroK8s install time. You should be able to add more uses in /var/snap/microk8s/current/credentials/basic_auth.csv. You can read more here: https://kubernetes.io/docs/reference/access-authn-authz/authentication/#static-password-file

keltik85 commented 5 years ago

Hi, I did the following to get microk8s running (using this guide):

root@my-pc~# sudo snap install microk8s --classic
root@my-pc~# microk8s.enable dns dashboard

root@my-pc:/home/myuser/Downloads/microservices-demo# kubectl cluster-info
Kubernetes master is running at https://127.0.0.1:16443
Heapster is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/heapster/proxy
KubeDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Grafana is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy
InfluxDB is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-influxdb:http/proxy

Problem is I cant access the Grafana Board at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy , because i don't know where to look up the username/password that is generated by default.

EDIT:

OK I found the default username/password in the file: /var/snap/microk8s/current/credentials/basic_auth.csv

khteh commented 5 years ago

/var/snap/microk8s/current/config

On Thu, Apr 4, 2019, 17:37 keltik85 notifications@github.com wrote:

Hi, I did the following to get microk8s running (using this guide https://tutorials.ubuntu.com/tutorial/install-a-local-kubernetes-with-microk8s#3 ):

root@my-pc~# sudo snap install microk8s --classic root@my-pc~# microk8s.enable dns dashboard

root@my-pc:/home/atekin/Downloads/microservices-demo# kubectl cluster-info Kubernetes master is running at https://127.0.0.1:16443 Heapster is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/heapster/proxy KubeDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy Grafana is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy InfluxDB is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-influxdb:http/proxy

Problem is I cant access the Grafana Board at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy , because i don't know where to look up the username/password that is generated by default.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ubuntu/microk8s/issues/389#issuecomment-479825850, or mute the thread https://github.com/notifications/unsubscribe-auth/ADsS-2fHd8srPyCS0Vk4qAq8aGHSO7Scks5vdcfcgaJpZM4cNLnP .

StoyanStAtanasov commented 3 years ago

The docs say /var/snap/microk8s/current/credentials/basic_auth.csv available for versions prior to 1.19. Where to find grafana credentials for 1.19 and up?

Temikus commented 3 years ago

@StoyanStAtanasov it's default Grafana password/login now:

tbscode commented 1 year ago

I'm using microk8s (v1.25.14 rev 5975) with observability enabled.

First of all I do not see Grafana listed when I run microk8s kubectl cluster-info:

Kubernetes control plane is running at https://127.0.0.1:16443
CoreDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

But I do see the following service (microk8s kubectl get svc -n observability):

NAME                             TYPE         CLUSTER-IP       EXTERNAL-IP   PORT(S)
kube-prom-stack-grafana   ClusterIP        <...>                   <none>        80/TCP

If I port forward this to my local machine I can see the grafana login screen. I can login with credentials retrieved from the secret kube-prom-stack-grafana also in the observability namespace.

Default seem to be admin:prom-operator.

How can I change them? / Set different initial defaults?

/var/snap/microk8s/current/credentials/basic_auth.csv doesn't seem to exist for me at all. That was replaced by /var/snap/microk8s/current/credentials/known_tokens.csv as per docs, which doesn't contain the grafana creds either.

tbscode commented 1 year ago

Ok got two ways:

Still wondering if there is some way to configure default for this, would be nice for automatic setups.

codespearhead commented 6 months ago

The credentials for the new observability add-on: (user/pass: admin/prom-operator)