deployment.yaml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. ---
  2. kind: ClusterRoleBinding
  3. apiVersion: rbac.authorization.k8s.io/v1
  4. metadata:
  5. name: default-grafana
  6. labels:
  7. app: grafana
  8. subjects:
  9. - kind: ServiceAccount
  10. name: default-grafana
  11. namespace: onecloud
  12. roleRef:
  13. kind: ClusterRole
  14. name: default-grafana
  15. apiGroup: rbac.authorization.k8s.io
  16. ---
  17. kind: ClusterRole
  18. apiVersion: rbac.authorization.k8s.io/v1
  19. metadata:
  20. labels:
  21. app: grafana
  22. name: default-grafana
  23. rules:
  24. - apiGroups: [""]
  25. resources: ["configmaps", "secrets"]
  26. verbs: ["get", "watch", "list"]
  27. ---
  28. apiVersion: v1
  29. kind: ServiceAccount
  30. metadata:
  31. labels:
  32. app: grafana
  33. name: default-grafana
  34. namespace: onecloud
  35. ---
  36. apiVersion: apps/v1
  37. kind: Deployment
  38. metadata:
  39. name: default-grafana
  40. namespace: onecloud
  41. labels:
  42. app: grafana
  43. spec:
  44. replicas: 1
  45. selector:
  46. matchLabels:
  47. app: grafana
  48. template:
  49. metadata:
  50. labels:
  51. app: grafana
  52. annotations:
  53. a: b
  54. spec:
  55. initContainers:
  56. - name: default-grafana-sc-datasources
  57. image: kiwigrid/k8s-sidecar:0.1.20
  58. imagePullPolicy: IfNotPresent
  59. env:
  60. - name: METHOD
  61. value: LIST
  62. - name: LABEL
  63. value: grafana_datasource
  64. - name: FOLDER
  65. value: "/etc/grafana/provisioning/datasources"
  66. - name: RESOURCE
  67. value: "both"
  68. volumeMounts:
  69. - name: sc-datasources-volume
  70. mountPath: "/etc/grafana/provisioning/datasources"
  71. containers:
  72. - name: grafana
  73. image: grafana/grafana:6.5.2
  74. imagePullPolicy: IfNotPresent
  75. env:
  76. - name: GF_SECURITY_ADMIN_USER
  77. valueFrom:
  78. secretKeyRef:
  79. key: admin-user
  80. name: default-grafana
  81. - name: GF_SECURITY_ADMIN_PASSWORD
  82. valueFrom:
  83. secretKeyRef:
  84. key: admin-password
  85. name: default-grafana
  86. ports:
  87. - name: service
  88. containerPort: 80
  89. protocol: TCP
  90. - name: grafana
  91. containerPort: 3000
  92. protocol: TCP
  93. volumeMounts:
  94. - mountPath: /etc/grafana/grafana.ini
  95. name: config
  96. subPath: grafana.ini
  97. - mountPath: /etc/grafana/ldap.toml
  98. name: ldap
  99. subPath: ldap.toml
  100. - mountPath: /var/lib/grafana
  101. name: storage
  102. - mountPath: /etc/grafana/provisioning/datasources
  103. name: sc-datasources-volume
  104. serviceAccountName: default-grafana
  105. volumes:
  106. - name: config
  107. configMap:
  108. defaultMode: 420
  109. name: default-grafana
  110. - name: ldap
  111. secret:
  112. defaultMode: 420
  113. items:
  114. - key: ldap-toml
  115. path: ldap.toml
  116. secretName: default-grafana
  117. - name: storage
  118. persistentVolumeClaim:
  119. claimName: default-grafana-data
  120. - name: sc-datasources-volume
  121. emptyDir: {}
  122. #persistentVolumeClaim:
  123. #claimName: default-grafana-sc-datasources-volume
  124. ---
  125. apiVersion: v1
  126. kind: Service
  127. metadata:
  128. labels:
  129. app: grafana
  130. name: default-grafana
  131. namespace: onecloud
  132. spec:
  133. ports:
  134. - name: service
  135. port: 80
  136. protocol: TCP
  137. targetPort: 3000
  138. selector:
  139. app: grafana
  140. type: ClusterIP