From 38e28e21d71db7868cfafc15e77fa3aa9feda351 Mon Sep 17 00:00:00 2001 From: ChimbuChinnadurai Date: Tue, 20 Feb 2024 10:20:00 +0000 Subject: [PATCH 1/6] initial commit --- README.md | 42 +- doit-eks-lens/.github/workflows/release.yml | 27 ++ doit-eks-lens/.helmignore | 23 + doit-eks-lens/Chart.yaml | 6 + doit-eks-lens/templates/_helpers.tpl | 61 +++ .../templates/doit-kube-state-metrics.yaml | 229 ++++++++++ doit-eks-lens/templates/doit-otelcol.yaml | 414 ++++++++++++++++++ doit-eks-lens/values.yaml | 23 + 8 files changed, 824 insertions(+), 1 deletion(-) create mode 100644 doit-eks-lens/.github/workflows/release.yml create mode 100644 doit-eks-lens/.helmignore create mode 100644 doit-eks-lens/Chart.yaml create mode 100644 doit-eks-lens/templates/_helpers.tpl create mode 100644 doit-eks-lens/templates/doit-kube-state-metrics.yaml create mode 100644 doit-eks-lens/templates/doit-otelcol.yaml create mode 100644 doit-eks-lens/values.yaml diff --git a/README.md b/README.md index 27b2e1b..57c29be 100644 --- a/README.md +++ b/README.md @@ -1 +1,41 @@ -# doit-eks-metrics-helm-chart \ No newline at end of file +# doit-eks-lens-helm-chart + +Repository contains the helm chart templates to install the components required for [EKS Lens](#https://help.doit.com/docs/dashboards/eks-lens). + +## Usage + +[Helm](https://helm.sh) must be installed to use the charts. Please refer to Helm's [documentation](https://helm.sh/docs) to get started. + +Once Helm has been set up correctly, add the repo as follows: + + helm repo add doit-eks-lens https://doitintl.github.io/doit-eks-lens-helm-chart/ + +If you had already added this repo earlier, run `helm repo update` to retrieve the latest versions of the packages.You can then run `helm search repo doit-eks-lens` to see the charts. + +To generate templates: + + helm template doit-eks-lens-helm-chart/doit-eks-lens + +To install the doit-eks-lens chart: + + helm install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region= \ + --set metricsDeploymentId= \ + --set s3_bucket= \ + --set s3_prefix= \ + --set role_arn= \ + --namespace doit-eks-metrics \ + --create-namespace + +Example: + + helm install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region=us-east-1 \ + --set metricsDeploymentId=2Dw7oXwSkgjwjsXGcSMr \ + --set s3_bucket=doitintl-eks-metrics-410386763839-us-east-1 \ + --set s3_prefix=eks-metrics/410386763839/us-east-1/public \ + --set role_arn=arn:aws:iam::410386763839:role/doit_eks_us-east-1_public \ + --namespace doit-eks-metrics \ + --create-namespace + +To uninstall the chart: + + helm delete doit-eks-lens --namespace doit-eks-metrics \ No newline at end of file diff --git a/doit-eks-lens/.github/workflows/release.yml b/doit-eks-lens/.github/workflows/release.yml new file mode 100644 index 0000000..05e84f9 --- /dev/null +++ b/doit-eks-lens/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Release Charts + +on: + push: + branches: + - main + +jobs: + release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.6.0 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/doit-eks-lens/.helmignore b/doit-eks-lens/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/doit-eks-lens/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/doit-eks-lens/Chart.yaml b/doit-eks-lens/Chart.yaml new file mode 100644 index 0000000..e540619 --- /dev/null +++ b/doit-eks-lens/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: doit-eks-lens +description: A Helm chart for DoiT EKS lens +type: application +version: 1.0.0 +appVersion: "1.0.0" diff --git a/doit-eks-lens/templates/_helpers.tpl b/doit-eks-lens/templates/_helpers.tpl new file mode 100644 index 0000000..8828465 --- /dev/null +++ b/doit-eks-lens/templates/_helpers.tpl @@ -0,0 +1,61 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "doit-eks-lens.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "doit-eks-lens.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "doit-eks-lens.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "doit-eks-lens.labels" -}} +helm.sh/chart: {{ include "doit-eks-lens.chart" . }} +{{ include "doit-eks-lens.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "doit-eks-lens.selectorLabels" -}} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "doit-eks-lens.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "doit-eks-lens.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/doit-eks-lens/templates/doit-kube-state-metrics.yaml b/doit-eks-lens/templates/doit-kube-state-metrics.yaml new file mode 100644 index 0000000..70b6f69 --- /dev/null +++ b/doit-eks-lens/templates/doit-kube-state-metrics.yaml @@ -0,0 +1,229 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: doit-kube-state-metrics + labels: + {{- include "doit-eks-lens.labels" . | nindent 4 }} + annotations: + eks.amazonaws.com/role-arn: {{ quote .Values.role_arn }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: doit-kube-state-metrics + labels: + app: doit-kube-state-metrics + {{- include "doit-eks-lens.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - configmaps + - secrets + - nodes + - pods + - services + - serviceaccounts + - resourcequotas + - replicationcontrollers + - limitranges + - persistentvolumeclaims + - persistentvolumes + - namespaces + - endpoints + verbs: + - list + - watch +- apiGroups: + - apps + resources: + - statefulsets + - daemonsets + - deployments + - replicasets + verbs: + - list + - watch +- apiGroups: + - batch + resources: + - cronjobs + - jobs + verbs: + - list + - watch +- apiGroups: + - autoscaling + resources: + - horizontalpodautoscalers + verbs: + - list + - watch +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create +- apiGroups: + - policy + resources: + - poddisruptionbudgets + verbs: + - list + - watch +- apiGroups: + - certificates.k8s.io + resources: + - certificatesigningrequests + verbs: + - list + - watch +- apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - list + - watch +- apiGroups: + - storage.k8s.io + resources: + - storageclasses + - volumeattachments + verbs: + - list + - watch +- apiGroups: + - admissionregistration.k8s.io + resources: + - mutatingwebhookconfigurations + - validatingwebhookconfigurations + verbs: + - list + - watch +- apiGroups: + - networking.k8s.io + resources: + - networkpolicies + - ingressclasses + - ingresses + verbs: + - list + - watch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - list + - watch +- apiGroups: + - rbac.authorization.k8s.io + resources: + - clusterrolebindings + - clusterroles + - rolebindings + - roles + verbs: + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: doit-kube-state-metrics + labels: + app: doit-kube-state-metrics + {{- include "doit-eks-lens.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: 'doit-kube-state-metrics' +subjects: +- kind: ServiceAccount + name: 'doit-kube-state-metrics' + namespace: '{{ .Release.Namespace }}' +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kube-state-metrics + labels: + app.kubernetes.io/component: exporter + k8s-app: kube-state-metrics + {{- include "doit-eks-lens.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.kubeStateMetrics.replicas }} + selector: + matchLabels: + app.kubernetes.io/name: kube-state-metrics + {{- include "doit-eks-lens.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: exporter + app.kubernetes.io/name: kube-state-metrics + {{- include "doit-eks-lens.selectorLabels" . | nindent 8 }} + spec: + automountServiceAccountToken: true + containers: + - args: + - --port=8080 + - --resources=cronjobs,daemonsets,deployments,jobs,nodes,pods,replicasets,replicationcontrollers,resourcequotas,statefulsets + - --metric-labels-allowlist=pods=[*],nodes=[*] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: KUBERNETES_CLUSTER_DOMAIN + value: "cluster.local" + image: {{ .Values.kubeStateMetrics.kubeStateMetrics.image.repository }}:{{ .Values.kubeStateMetrics.kubeStateMetrics.image.tag }} + imagePullPolicy: {{ .Values.kubeStateMetrics.kubeStateMetrics.imagePullPolicy }} + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: 8080 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: kube-state-metrics + ports: + - containerPort: 80 + name: http-metrics + readinessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8080 + scheme: HTTP + resources: {} + restartPolicy: Always + serviceAccount: doit-kube-state-metrics +--- +apiVersion: v1 +kind: Service +metadata: + name: kube-state-metrics + labels: + {{- include "doit-eks-lens.labels" . | nindent 4 }} +spec: + type: ClusterIP + selector: + app.kubernetes.io/name: kube-state-metrics + {{- include "doit-eks-lens.selectorLabels" . | nindent 4 }} + ports: + - name: http-metrics + port: 8080 \ No newline at end of file diff --git a/doit-eks-lens/templates/doit-otelcol.yaml b/doit-eks-lens/templates/doit-otelcol.yaml new file mode 100644 index 0000000..e12905c --- /dev/null +++ b/doit-eks-lens/templates/doit-otelcol.yaml @@ -0,0 +1,414 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: doit-collector + labels: + app: doit-collector + {{- include "doit-eks-lens.labels" . | nindent 4 }} + annotations: + eks.amazonaws.com/role-arn: {{ quote .Values.role_arn }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: doit-otel + labels: + app: doit-collector + {{- include "doit-eks-lens.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - events + - namespaces + - namespaces/status + - nodes + - nodes/spec + - nodes/stats + - nodes/proxy + - pods + - pods/status + - replicationcontrollers + - replicationcontrollers/status + - resourcequotas + - services + verbs: + - get + - list + - watch +- apiGroups: + - apps + resources: + - daemonsets + - deployments + - replicasets + - statefulsets + verbs: + - get + - list + - watch +- apiGroups: + - extensions + resources: + - daemonsets + - deployments + - replicasets + verbs: + - get + - list + - watch +- apiGroups: + - batch + resources: + - jobs + - cronjobs + verbs: + - get + - list + - watch +- apiGroups: + - autoscaling + resources: + - horizontalpodautoscalers + verbs: + - get + - list + - watch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - list + - update +- apiGroups: + - "" + resources: + - pods + - nodes + - endpoints + verbs: + - list + - watch +- apiGroups: + - "" + resources: + - nodes/proxy + verbs: + - get +- apiGroups: + - "" + resources: + - nodes/stats + - configmaps + - events + verbs: + - create + - get +- apiGroups: + - "" + resourceNames: + - otel-container-insight-clusterleader + resources: + - configmaps + verbs: + - get + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: doit-otel + labels: + app: doit-otel + {{- include "doit-eks-lens.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: 'doit-otel' +subjects: +- kind: ServiceAccount + name: 'doit-collector' + namespace: '{{ .Release.Namespace }}' +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: doit-collector-config + labels: + doit.com/metrics-deployment-id: {{ quote .Values.metricsDeploymentId }} + k8s-app: opentelemetry-collector + {{- include "doit-eks-lens.labels" . | nindent 4 }} +data: + collector.yaml: |- + receivers: + prometheus_simple: + collection_interval: 60s + endpoint: 'kube-state-metrics:8080' + metrics_path: '/metrics' + tls: + insecure: true + insecure_skip_verify: true + processors: + batch: + send_batch_max_size: 1000 + timeout: 30s + send_batch_size : 800 + memory_limiter: + check_interval: 1s + limit_percentage: 70 + spike_limit_percentage: 30 + resource/1: + attributes: + - key: service.name + action: delete + - key: net.host.name + action: delete + - key: service.instance.id + action: delete + - key: net.host.port + action: delete + - key: http.scheme + action: delete + attributes/1: + actions: + - key: container_runtime_version + action: delete + - key: host_ip + action: delete + - key: host_network + action: delete + - key: pod_ip + action: delete + - key: internal_ip + action: delete + - key: kernel_version + action: delete + - key: kubelet_version + action: delete + - key: kubeproxy_version + action: delete + - key: os_image + action: delete + - key: priority_class + action: delete + - key: label_pod_template_hash + action: delete + - key: label_controller_revision_hash + action: delete + - key: label_pod_template_generation + action: delete + - key: label_beta_kubernetes_io_arch + action: delete + - key: label_beta_kubernetes_io_os + action: delete + - key: label_eks_amazonaws_com_nodegroup_image + action: delete + - key: label_kubernetes_io_arch + action: delete + - key: label_failure_domain_beta_kubernetes_io_region + action: delete + - key: label_failure_domain_beta_kubernetes_io_zone + action: delete + - key: label_kubernetes_io_os + action: delete + - key: label_kubernetes_io_hostnamea + action: delete + metricstransform/add: + transforms: + - include: .* + match_type: regexp + action: update + operations: + - action: add_label + new_label: doit.com/metrics-deployment-id + new_value: {{ quote .Values.metricsDeploymentId }} + - include: kube_pod_init_container_resource_requests + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: init_resource_requests + - include: kube_pod_init_container_resource_limits + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: init_resource_limits + - include: kube_pod_init_container_status_running + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: init_container_running + - include: kube_pod_info + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: pod_info + - include: kube_pod_container_status_running + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: container_running + - include: kube_pod_container_resource_requests + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: resource_requests + - include: kube_pod_container_resource_limits + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: resource_limits + - include: kube_pod_labels + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: pod_labels + - include: kube_node_info + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: node_info + - include: kube_node_labels + action: update + operations: + - action: add_label + new_label: metrics_name + new_value: node_labels + filter/1: + metrics: + include: + match_type: strict + metric_names: + - kube_pod_init_container_resource_limits + - kube_pod_init_container_resource_requests + - kube_pod_init_container_status_running + - kube_pod_info + - kube_pod_labels + - kube_pod_container_status_running + - kube_pod_container_resource_limits + - kube_pod_container_resource_requests + - kube_node_info + - kube_node_labels + exporters: + # logging: + # loglevel: debug + awss3: + s3uploader: + region: {{ quote .Values.region }} + s3_bucket: {{ quote .Values.s3_bucket }} + s3_prefix: {{ quote .Values.s3_prefix }} + file_prefix: ${K8S_NODE_NAME} + s3_partition: 'minute' + extensions: + memory_ballast: + size_in_percentage: 20 + health_check: {} + service: + telemetry: + # logs: + # level: DEBUG + metrics: + address: ":8888" + extensions: [memory_ballast, health_check] + pipelines: + metrics: + receivers: [prometheus_simple] + processors: [resource/1, filter/1, attributes/1, metricstransform/add, memory_limiter, batch] + exporters: [awss3] # logging, +--- + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: collector + labels: + doit.com/metrics-deployment-id: {{ quote .Values.metricsDeploymentId }} + k8s-app: opentelemetry-collector + {{- include "doit-eks-lens.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.collector.replicas }} + selector: + matchLabels: + app.kubernetes.io/name: doit-collector + {{- include "doit-eks-lens.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: metrics + app.kubernetes.io/name: doit-collector + doit.com/metrics-deployment-id: {{ quote .Values.metricsDeploymentId }} + {{- include "doit-eks-lens.selectorLabels" . | nindent 8 }} + spec: + containers: + - args: + - --config=/conf/collector.yaml + env: + - name: K8S_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: HOST_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: HOST_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: K8S_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: KUBERNETES_CLUSTER_DOMAIN + value: "cluster.local" + image: {{ .Values.collector.otelcol.image.repository }}:{{ .Values.collector.otelcol.image.tag }} + imagePullPolicy: {{ .Values.collector.otelcol.imagePullPolicy }} + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 13133 + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + name: otelcol + ports: + - containerPort: 8888 + hostPort: 8888 + name: metrics + protocol: TCP + resources: {} + volumeMounts: + - mountPath: /conf + name: doit-collector-config + readOnly: true + restartPolicy: Always + serviceAccount: doit-collector + volumes: + - configMap: + defaultMode: 420 + items: + - key: collector.yaml + path: collector.yaml + name: doit-collector-config + name: doit-collector-config \ No newline at end of file diff --git a/doit-eks-lens/values.yaml b/doit-eks-lens/values.yaml new file mode 100644 index 0000000..095c099 --- /dev/null +++ b/doit-eks-lens/values.yaml @@ -0,0 +1,23 @@ +collector: + otelcol: + image: + repository: otel/opentelemetry-collector-contrib + tag: 0.83.0 + imagePullPolicy: IfNotPresent + replicas: 1 +doitKubeStateMetrics: + serviceAccount: + annotations: {} +kubeStateMetrics: + kubeStateMetrics: + image: + repository: registry.k8s.io/kube-state-metrics/kube-state-metrics + tag: v2.9.2 + imagePullPolicy: IfNotPresent + replicas: 1 +kubernetesClusterDomain: cluster.local +metricsDeploymentId: # 2Dw7oXwSkgjwjsXGcSMr +s3_bucket: #'doitintl-eks-metrics-410386763839-us-east-1' +s3_prefix: #'eks-metrics/410386763839/us-east-1/public' +role_arn: #arn:aws:iam::410386763839:role/doit_eks_us-east-1_public +region: # us-east-1 \ No newline at end of file From f5421c8a660b20e932656e6fff6db5c2d9b6e326 Mon Sep 17 00:00:00 2001 From: ChimbuChinnadurai Date: Tue, 20 Feb 2024 10:21:29 +0000 Subject: [PATCH 2/6] moved the github folder to root --- {doit-eks-lens/.github => .github}/workflows/release.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {doit-eks-lens/.github => .github}/workflows/release.yml (100%) diff --git a/doit-eks-lens/.github/workflows/release.yml b/.github/workflows/release.yml similarity index 100% rename from doit-eks-lens/.github/workflows/release.yml rename to .github/workflows/release.yml From 18f4e000506bc71ea980da0a4bd69671036ace7b Mon Sep 17 00:00:00 2001 From: ChimbuChinnadurai Date: Tue, 20 Feb 2024 11:41:18 +0000 Subject: [PATCH 3/6] Added changes to skip kube-state-metrics deployment if customer already installed a kube-state-metrics in the cluster --- .../templates/doit-kube-state-metrics.yaml | 8 ++++--- doit-eks-lens/templates/doit-otelcol.yaml | 8 ++++--- doit-eks-lens/values.yaml | 22 ++++++++----------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/doit-eks-lens/templates/doit-kube-state-metrics.yaml b/doit-eks-lens/templates/doit-kube-state-metrics.yaml index 70b6f69..abce441 100644 --- a/doit-eks-lens/templates/doit-kube-state-metrics.yaml +++ b/doit-eks-lens/templates/doit-kube-state-metrics.yaml @@ -1,3 +1,4 @@ +{{- if .Values.kubeStateMetrics.install }} --- apiVersion: v1 kind: ServiceAccount @@ -187,8 +188,8 @@ spec: fieldPath: spec.nodeName - name: KUBERNETES_CLUSTER_DOMAIN value: "cluster.local" - image: {{ .Values.kubeStateMetrics.kubeStateMetrics.image.repository }}:{{ .Values.kubeStateMetrics.kubeStateMetrics.image.tag }} - imagePullPolicy: {{ .Values.kubeStateMetrics.kubeStateMetrics.imagePullPolicy }} + image: {{ .Values.kubeStateMetrics.image.repository }}:{{ .Values.kubeStateMetrics.image.tag }} + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 httpGet: @@ -226,4 +227,5 @@ spec: {{- include "doit-eks-lens.selectorLabels" . | nindent 4 }} ports: - name: http-metrics - port: 8080 \ No newline at end of file + port: 8080 +{{ end }} \ No newline at end of file diff --git a/doit-eks-lens/templates/doit-otelcol.yaml b/doit-eks-lens/templates/doit-otelcol.yaml index e12905c..45ed0d3 100644 --- a/doit-eks-lens/templates/doit-otelcol.yaml +++ b/doit-eks-lens/templates/doit-otelcol.yaml @@ -147,7 +147,11 @@ data: receivers: prometheus_simple: collection_interval: 60s + {{- if .Values.kubeStateMetrics.install }} endpoint: 'kube-state-metrics:8080' + {{ else }} + endpoint: {{ squote .Values.collector.otelcol.kubeStateMetrics.endpoint }} + {{- end }} metrics_path: '/metrics' tls: insecure: true @@ -328,8 +332,6 @@ data: processors: [resource/1, filter/1, attributes/1, metricstransform/add, memory_limiter, batch] exporters: [awss3] # logging, --- - ---- apiVersion: apps/v1 kind: Deployment metadata: @@ -381,7 +383,7 @@ spec: - name: KUBERNETES_CLUSTER_DOMAIN value: "cluster.local" image: {{ .Values.collector.otelcol.image.repository }}:{{ .Values.collector.otelcol.image.tag }} - imagePullPolicy: {{ .Values.collector.otelcol.imagePullPolicy }} + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 httpGet: diff --git a/doit-eks-lens/values.yaml b/doit-eks-lens/values.yaml index 095c099..329ce9a 100644 --- a/doit-eks-lens/values.yaml +++ b/doit-eks-lens/values.yaml @@ -1,21 +1,17 @@ +kubeStateMetrics: + install: true + replicas: 1 + image: + repository: registry.k8s.io/kube-state-metrics/kube-state-metrics + tag: v2.9.2 collector: otelcol: + replicas: 1 image: repository: otel/opentelemetry-collector-contrib tag: 0.83.0 - imagePullPolicy: IfNotPresent - replicas: 1 -doitKubeStateMetrics: - serviceAccount: - annotations: {} -kubeStateMetrics: - kubeStateMetrics: - image: - repository: registry.k8s.io/kube-state-metrics/kube-state-metrics - tag: v2.9.2 - imagePullPolicy: IfNotPresent - replicas: 1 -kubernetesClusterDomain: cluster.local + kubeStateMetrics: + endpoint: "kube-state-metrics:8080" metricsDeploymentId: # 2Dw7oXwSkgjwjsXGcSMr s3_bucket: #'doitintl-eks-metrics-410386763839-us-east-1' s3_prefix: #'eks-metrics/410386763839/us-east-1/public' From 59171d43ffb32aeef0f0050639d2aea53101211f Mon Sep 17 00:00:00 2001 From: ChimbuChinnadurai Date: Tue, 20 Feb 2024 11:42:10 +0000 Subject: [PATCH 4/6] updated readme --- README.md | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 57c29be..a66b54a 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ To generate templates: helm template doit-eks-lens-helm-chart/doit-eks-lens -To install the doit-eks-lens chart: +To install the doit-eks-lens chart with its own kube-state-metrics deployment: - helm install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region= \ + helm upgrade -install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region= \ --set metricsDeploymentId= \ --set s3_bucket= \ --set s3_prefix= \ @@ -28,7 +28,7 @@ To install the doit-eks-lens chart: Example: - helm install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region=us-east-1 \ + helm upgrade -install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region=us-east-1 \ --set metricsDeploymentId=2Dw7oXwSkgjwjsXGcSMr \ --set s3_bucket=doitintl-eks-metrics-410386763839-us-east-1 \ --set s3_prefix=eks-metrics/410386763839/us-east-1/public \ @@ -36,6 +36,31 @@ Example: --namespace doit-eks-metrics \ --create-namespace +To install the doit-eks-lens chart without kube-state-metrics deployment and use an existing kube-state-metrics in the cluster: + + helm upgrade -install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region= \ + --set metricsDeploymentId= \ + --set s3_bucket= \ + --set s3_prefix= \ + --set role_arn= \ + --set kubeStateMetrics.install=false \ + --set collector.otelcol.kubeStateMetrics.endpoint= \ + --namespace doit-eks-metrics \ + --create-namespace + +Example: + +helm upgrade -install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region=us-west-2 \ + --set metricsDeploymentId=2Dw7oXwSkgjwjsXGcSMr \ + --set s3_bucket=doitintl-eks-metrics-317630533282-us-west-2 \ + --set s3_prefix=eks-metrics/317630533282/us-west-2/wonderful-sheepdog-1708421720 \ + --set role_arn=arn:aws:iam::317630533282:role/doit_eks_us-west-2_wonderful-sheepdog-1708421720 \ + --set kubeStateMetrics.install=false \ + --set collector.otelcol.kubeStateMetrics.endpoint="kube-state-metrics.kube-system:8080" \ + --namespace doit-eks-metrics \ + --create-namespace + + To uninstall the chart: helm delete doit-eks-lens --namespace doit-eks-metrics \ No newline at end of file From eff329bea6533d085a58ab2eee9fa0e5981c50bf Mon Sep 17 00:00:00 2001 From: ChimbuChinnadurai Date: Tue, 20 Feb 2024 11:42:35 +0000 Subject: [PATCH 5/6] updated readme --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a66b54a..0bd37ad 100644 --- a/README.md +++ b/README.md @@ -50,15 +50,15 @@ To install the doit-eks-lens chart without kube-state-metrics deployment and use Example: -helm upgrade -install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region=us-west-2 \ - --set metricsDeploymentId=2Dw7oXwSkgjwjsXGcSMr \ - --set s3_bucket=doitintl-eks-metrics-317630533282-us-west-2 \ - --set s3_prefix=eks-metrics/317630533282/us-west-2/wonderful-sheepdog-1708421720 \ - --set role_arn=arn:aws:iam::317630533282:role/doit_eks_us-west-2_wonderful-sheepdog-1708421720 \ - --set kubeStateMetrics.install=false \ - --set collector.otelcol.kubeStateMetrics.endpoint="kube-state-metrics.kube-system:8080" \ - --namespace doit-eks-metrics \ - --create-namespace + helm upgrade -install doit-eks-lens doit-eks-lens-helm-chart/doit-eks-lens --set region=us-west-2 \ + --set metricsDeploymentId=2Dw7oXwSkgjwjsXGcSMr \ + --set s3_bucket=doitintl-eks-metrics-317630533282-us-west-2 \ + --set s3_prefix=eks-metrics/317630533282/us-west-2/wonderful-sheepdog-1708421720 \ + --set role_arn=arn:aws:iam::317630533282:role/doit_eks_us-west-2_wonderful-sheepdog-1708421720 \ + --set kubeStateMetrics.install=false \ + --set collector.otelcol.kubeStateMetrics.endpoint="kube-state-metrics.kube-system:8080" \ + --namespace doit-eks-metrics \ + --create-namespace To uninstall the chart: From a04968d0c0909aa6245346610635d17ecc57762f Mon Sep 17 00:00:00 2001 From: Chimbu Chinnadurai <112865563+Chimbu-DoiT@users.noreply.github.com> Date: Wed, 21 Feb 2024 09:58:28 +0000 Subject: [PATCH 6/6] added dummy data to values.yaml --- doit-eks-lens/values.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doit-eks-lens/values.yaml b/doit-eks-lens/values.yaml index 329ce9a..f67917a 100644 --- a/doit-eks-lens/values.yaml +++ b/doit-eks-lens/values.yaml @@ -12,8 +12,8 @@ collector: tag: 0.83.0 kubeStateMetrics: endpoint: "kube-state-metrics:8080" -metricsDeploymentId: # 2Dw7oXwSkgjwjsXGcSMr -s3_bucket: #'doitintl-eks-metrics-410386763839-us-east-1' -s3_prefix: #'eks-metrics/410386763839/us-east-1/public' -role_arn: #arn:aws:iam::410386763839:role/doit_eks_us-east-1_public -region: # us-east-1 \ No newline at end of file +metricsDeploymentId: xxxxxxxxx +s3_bucket: 'doitintl-eks-metrics-xxxxxxxx-us-east-1' +s3_prefix: 'eks-metrics/xxxxxxxx/us-east-1/public' +role_arn: arn:aws:iam::xxxxxxxx:role/doit_eks_us-east-1_public +region: us-east-1