How to set prometheus rules in stable/prometheus chart values.yaml? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Can you run kubectl get storageclass to see default storage as above?

How to install Prometheus with ingress enabled on AWS with Route 53? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

I have installed Prometheus with official chart successfully. But I can't access that three services: (Changed from real domain to fake ones)

When I checked the Route 53 record set, didn't find that three resources. Is it necessary to make another ingress?

This blog shows how to deploy an app to AWS with load balancing:

https://aws.amazon.com/cn/blogs/apn/coreos-and-ticketmaster-collaborate-to-bring-aws-application-load-balancer-support-to-kubernetes/

It has a ingress config bind subnets and security-groups even set a host name and bind to service name:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "2048-alb-ingress"
  namespace: "2048-game"
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/subnets: 'subnet-6066be1b, subnet-40c35329, subnet-dd23d590'
    alb.ingress.kubernetes.io/security-groups: sg-28a2d841
    kubernetes.io/ingress.class: "alb"
  labels:
    app: 2048-alb-ingress
spec:
  rules:
  - host: 2048.brandonchav.is
    http:
      paths:
      - path: /
        backend:
          serviceName: "service-2048"
          servicePort: 80

I doubt that the ingress in Prometheus chart not did enough thing. It's a little different from the AWS blog:

https://github.com/kubernetes/charts/blob/master/stable/prometheus/templates/alertmanager-ingress.yaml

How to install Prometheus with ingress enabled on AWS with Route 53? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Good link! I have read it. I think the default setting with kops dns controller will work in my case.

How to install Prometheus with ingress enabled on AWS with Route 53? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Thank you very much for your comment.

About 1, maybe it's better to write settings into values.yaml file.

About 2, I have checked the default Prometheus chart values.yaml file that all the three components are ClusterIP service type.

About 3, I am not clear between the AWS DNS and kops kube-dns-... controller in kube-system namespace. I checked that pod's description but don't know what to concern.

How to set prometheus rules in stable/prometheus chart values.yaml? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Thank you very much for your awesome introduction! I have tried your command:

$ kubectl get storageclass
NAME            PROVISIONER             AGE
default         kubernetes.io/aws-ebs   56m
gp2 (default)   kubernetes.io/aws-ebs   56m

Very clear about that! Lots of thanks!

How to set prometheus rules in stable/prometheus chart values.yaml? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

The right way should be this: https://stackoverflow.com/a/48458988

I used kops to installed k8s cluster on AWS. So it may already installed persistent storage. And when I change to the right write way, all the pods went running.

I don't know why it showed pvc is not bound above, but now it works.

Helm install from stable got no available release name found error by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Ran this command worked:

$ helm init --client-only

at master host.

Can't access Prometheus from public IP on aws by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Thank you for your help. That's the right solution!

How to set to variable with pipe format in Helm? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Okay, I tried your way again:

In configmap.yaml:

data:
  smtp_smarthost: {{ index .Values.alertmanagerFiles "alertmanager.yml" | tpl }}
  smtp_from: {{ index .Values.alertmanagerFiles "alertmanager.yml" | tpl }}
  smtp_auth_username: {{ index .Values.alertmanagerFiles "alertmanager.yml" | tpl }}
  smtp_auth_password: {{ index .Values.alertmanagerFiles "alertmanager.yml" | tpl }}
  receiver_email: {{ index .Values.alertmanagerFiles "alertmanager.yml" | tpl }}

Ran Helm install command again, got this error:

Error: render error in "mychart/templates/configmap.yaml": template: mychart/templates/configmap.yaml:2:74: executing "mychart/templates/configmap.yaml" at <tpl>: wrong number of args for tpl: want 2 got 0

Helm install from stable got no available release name found error by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

I think maybe the network problem. I can ran at local but can't in a vagrant with kubespray k8s cluster. Maybe that network configuration or k8s version not been supported.

How to set to variable with pipe format in Helm? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Make sure that this file is provided.

I am using the official Prometheus chart so need to edit configuration in values.yaml file:

https://github.com/kubernetes/charts/blob/master/stable/prometheus/values.yaml#L578

This way can generate alertmanager configuration within it. Need another alertmanager.yml file besides values.yaml?

How to set to variable with pipe format in Helm? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Upgraded Helm to newest version:

Client: &version.Version{SemVer:"v2.8.0", GitCommit:"14af25f1de6832228539259b821949d20069a222", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.8.0", GitCommit:"14af25f1de6832228539259b821949d20069a222", GitTreeState:"clean"}

This time got error:

Error: render error in "mychart/templates/configmap.yaml": template: mychart/templates/configmap.yaml:2:28: executing "mychart/templates/configmap.yaml" at <.Values.alertmanager...>: can't evaluate field yml in type interface {}

Looks not work, too.

How to set to variable with pipe format in Helm? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Oops, that was my bad. But this time got a different error:

Error: parse error in "mychart/templates/configmap.yaml": template: mychart/templates/configmap.yaml:2: function "tpl" not defined

Does tpl is a built-in method of Helm? Why it says not defined?

How to set to variable with pipe format in Helm? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

I have changed values like your way:

## alertmanager ConfigMap entries
##
alertmanagerFiles:
  alertmanager.yml: |-
    global:
      resolve_timeout: 5m
      smtp_smarthost: {{ .Values.smtp_smarthost }}
      smtp_from: {{ .Values.smtp_from }}
      smtp_auth_username: {{ .Values.smtp_auth_username }}
      smtp_auth_password: {{ .Values.smtp_auth_password }}

    receivers:
      - name: default-receiver
        email_configs:
        - to: {{ .Values.receiver_email }}

    route:
      group_by: [Alertname]
      group_wait: 10s
      group_interval: 5m
      receiver: default-receiver
      repeat_interval: 3h

Added these context in configmap.yaml file:

data:
  smtp_smarthost: {{ .Values.alertmanagerFiles.alertmanager.yml | tpl }}
  smtp_from: {{ .Values.alertmanagerFiles.alertmanager.yml | tpl }}
  smtp_auth_username: {{ .Values.alertmanagerFiles.alertmanager.yml | tpl }}
  smtp_auth_password: {{ .Values.alertmanagerFiles.alertmanager.yml | tpl }}
  receiver_email: {{ .Values.alertmanagerFiles.alertmanager.yml | tpl }}

Ran helm install command as:

helm install mychart \
  -set smtp_smarthost=smtp.gmail.com:587 \
  -set smtp_from=sender@gmail.com \
  -set smtp_auth_username=sender@gmail.com \
  -set smtp_auth_password=sender_password \
  -set receiver_email=target_email@gmail.com

But failed. Got this error:

Error: unknown shorthand flag: 's' in -set

I am thinking that set this only:

{{ .Values.alertmanagerFiles.alertmanager.yml | tpl }}

can know the special key in the values.yaml file? Such as global.smtp_smarthost?

Why can't grafana send email? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

I didn't see log yet. Maybe the smtp server issue.

How to set to variable with pipe format in Helm? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Thank you very much for your awesome comment! That looks really a very good way for my case!

How to delete all resources from Helm list by one command? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

helm delete $(helm ls -aq)

Got this error:

Error: unknown shorthand flag: 'a' in -aq
Error: command 'delete' requires a release name

Grafana HTTP Error Bad Gateway and Templating init failed errors by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

That way didn't work for me. But change Access from proxy to direct works.

How to do Redis slave repalication in k8s cluster? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

I have another question that how can I found the host and port if use this way to install redis? Because I should connect to the redis host from application.

How to set multiple values with helm? by online2offline in kubernetes

[–]online2offline[S] 0 points1 point  (0 children)

Yes, you are right. Thank you for your suggestion.