Minikube / Grafana : connection refused

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Minikube version: v1.11.0
Host OS: Ubuntu 20.04

I’m trying to install Grafana in a minikube local cluster with minikube 1.13.0

Here is the whole process:

minikube start # this step is OK

I deploy Grafana with:

kubectl config use-context minikube
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
kubectl create secret generic grafana-env --from-env-file=.env.local --namespace=monitoring --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f deployment/local/grafana-pvc.yml
kubectl apply -f deployment/local/grafana-secret.yml
kubectl apply -f deployment/local/grafana-deployment.yml
kubectl apply -f deployment/local/grafana-svc.yml
kubectl apply -f deployment/local/grafana-ingress-local.yml

Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    reloader.stakater.com/auto: "true"
  name: grafana-core-local
  namespace: monitoring
  labels:
    app: grafana-local
    component: core
spec:
  selector:
    matchLabels:
      app: grafana-local
  replicas: 1
  template:
    metadata:
      labels:
        app: grafana-local
        component: core
    spec:
      dnsConfig:
        options:
          - name: ndots
            value: "0"
      initContainers:
      - name: init-chown-data
        image: grafana/grafana:7.0.0
        imagePullPolicy: IfNotPresent
        securityContext:
          runAsUser: 0
        command: ["chown", "-R", "472:472", "/var/lib/grafana"]
        volumeMounts:
        - name: grafana-persistent-storage
          mountPath: /var/lib/grafana
      containers:
      - image: grafana/grafana:7.0.0
        name: grafana-core-local
        imagePullPolicy: IfNotPresent
        securityContext:
          runAsUser: 472
        # env:
        resources:
          # keep request = limit to keep this container in guaranteed class
          limits:
            cpu: 100m
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 100Mi
        envFrom:
          - secretRef:
              name: grafana-env
        env:
          # The following env variables set up basic auth twith the default admin user and admin password.
          - name: GF_AUTH_BASIC_ENABLED
            value: "true"
          - name: GF_SECURITY_ADMIN_USER
            valueFrom:
              secretKeyRef:
                name: grafana
                key: admin-username
          - name: GF_SECURITY_ADMIN_PASSWORD
            valueFrom:
              secretKeyRef:
                name: grafana
                key: admin-password
          - name: GF_AUTH_ANONYMOUS_ENABLED
            value: "false"
          - name: GF_SERVER_ROOT_URL
            value: "http://grafana.local"
        readinessProbe:
          httpGet:
            path: /login
            port: 3000
        volumeMounts:
        - name: grafana-persistent-storage
          mountPath: /var/lib/grafana
        - name: grafana-datasources
          mountPath: /etc/grafana/provisioning/datasources
      volumes:
      - name: grafana-persistent-storage
        persistentVolumeClaim:
          claimName: grafana-storage
      - name: grafana-datasources
        configMap:
          name: grafana-datasources

Service :

apiVersion: v1
kind: Service
metadata:
  name: grafana-local
  namespace: monitoring
  labels:
    app: grafana-local
    component: core
spec:
  type: NodePort
  ports:
    - port: 3000
  selector:
    app: grafana-local
    component: core

And Ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: grafana-ingress
  namespace: monitoring
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: grafana.local
    http:
      paths:
      - backend:
         serviceName: grafana-local
         servicePort: 3000

I also added a grafana.local entry in /etc/hosts to link it to 127.0.0.1

Pod, service, and ingress are deployed successfully, I see no errors.

But when I try to access it through chrome, I get a ERR_CONNECTION_REFUSED error.

It is important to say that before, I was starting minikube with the none driver, and it was working well:

sudo minikube start --vm-driver none

Also, when I do:

minikube dashboard

I can access the dashboard with no problem.

Also, if I do:

kubectl -n monitoring port-forward svc/grafana-local 3000

I will be able to access Grafana on http://127.0.0.1:3000.

but isn’t it the same thing than

      ports:
        - port: 3000

What am my missing ?