Search code examples
kuberneteskubernetes-helmgrafanagrafana-loki

How to install Loki on minikube


I'm installing Loki on my Kubernetes minikube instance.

When I look at my pods I get one running out of three:

default       loki-write-0                                  1/1     Running       0          83m
default       loki-write-1                                  0/1     Pending       0          83m
default       loki-write-2                                  0/1     Pending       0          83m

logs on the running pod gives:

at least 1 live replicas required, could only find 0 - unhealthy instances

describe gives on the running pod:

Readiness probe failed: HTTP probe failed with statuscode: 503

describe on the dead pods:

0/1 nodes are available: 1 node(s) didn't match pod anti-affinity rules. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod..

So as you can see, it wants 3 pods but the affinity cannot be satisfied because I'm running minikube which is one node.

How do I tell Loki to run one instance only?

I have this variables.yaml file that specified one pod replication_factor: 1:

cat values.yaml 
loki:
  auth_enabled: false
  commonConfig:
    replication_factor: 1
  storage:
    bucketNames:
      chunks: chunks
      ruler: ruler
      admin: admin
    type: s3
    minio:
      enabled: true
  singleBinary:
    replicas: 1

But as you can see it still makes 3 pods anyways.

How do I tell it to make one pod and give that pod the affinity:

  nodeSelector:
    kubernetes.io/hostname: minikube

Here is the helm file I used to install Loki:

helm repo add grafana https://grafana.github.io/helm-charts
helm install --values values.yaml loki grafana/loki

and here is where I got the instruction in the first place.


Solution

  • The pods you listed in your question belong to the Loki-write statefulset, which is controlled by a different parameter in the chart, namely write.replicas (see this reference in the chart code).

    Once you change this parameter to 1 a single replica of the write statefulset should be scheduled.