OAuth2 with Grafana in Kubernetes - Configuration

5/23/2019

I have set up Grafana in Kubernetes Engine, that worked fine. My next step is authentication with our Azure AD. There is a configuration example here that I followed: https://grafana.com/docs/auth/generic-oauth/ (Azure AD)

However I get an error message when using the Oauth URL: https://8080-dot-7407391-dot-devshell.appspot.com/login/generic_oauth

"No OAuth with name auth.generic_oauth configured"

Here is my grafana.ini

paths:
  data: /var/lib/grafana/data
  logs: /var/log/grafana
  plugins: /var/lib/grafana/plugins
auth.generic_oauth:
  name: Azure AD
  enabled: true
  allow_sign_up: true
  client_id: b037304f-7254-42af-9f5c-6ab61d595ecd
  client_secret: XXXXXXXXXXXXXXXXXXXXX
  scopes: openid email name
  auth_url: https://login.microsoftonline.com/XXXXXXXX/oauth2/authorize
  token_url: https://login.microsoftonline.com/XXXXXXXX/oauth2/token
  api_url: 
  team_ids: 
  allowed_organizations:  
analytics:
  check_for_updates: true
log:
  mode: console
grafana_net:
  url: https://grafana.net

YAML:

apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app.kubernetes.io/component":"grafana-server","app.kubernetes.io/name":"grafana-1"},"name":"grafana-1-grafana","namespace":"default","ownerReferences":[{"apiVersion":"app.k8s.io/v1beta1","blockOwnerDeletion":true,"kind":"Application","name":"grafana-1","uid":"XXXXXXXXX"}]},"spec":{"ports":[{"name":"service","port":3000}],"selector":{"app.kubernetes.io/component":"grafana-server","app.kubernetes.io/name":"grafana-1"},"type":"ClusterIP"}}
  creationTimestamp: 2019-05-22T06:30:24Z
  labels:
    app.kubernetes.io/component: grafana-server
    app.kubernetes.io/name: grafana-1
  name: grafana-1-grafana
  namespace: default
  ownerReferences:
  - apiVersion: app.k8s.io/v1beta1
    blockOwnerDeletion: true
    kind: Application
    name: grafana-1
    uid: XXXXXXXXX
  resourceVersion: "326774"
  selfLink: /api/v1/namespaces/default/services/grafana-1-grafana
  uid: XXXXXXXXX
spec:
  clusterIP: 10.39.244.32
  externalTrafficPolicy: Cluster
  ports:
  - name: service
    nodePort: 31151
    port: 3000
    protocol: TCP
    targetPort: 3000
  selector:
    app.kubernetes.io/component: grafana-server
    app.kubernetes.io/name: grafana-1
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - ip: 34.90.109.28
-- TobyG
azure-active-directory
grafana
kubernetes

0 Answers