diff --git a/docs/getting-started/_index.md b/docs/getting-started/_index.md index 64ee37161d39..746ff383610b 100644 --- a/docs/getting-started/_index.md +++ b/docs/getting-started/_index.md @@ -12,8 +12,8 @@ with the Grafana Agent Operator, please refer to the Operator-specific Currently, there are six ways to install the agent: - Use our Docker container -- Use the Kubernetes install script (_recommended basic_) -- Use the Kubernetes manifest +- Use the Kubernetes manifests directly +- Use the Kubernetes manifests along with the [Grafana Cloud Kubernetes Quickstart Guides](#grafana-cloud-kubernetes-quickstart-guides) - Installing the static binaries locally - Using Grafana Labs' official Tanka configs (_recommended advanced_) - Using the [Windows Installer]({{< relref "./install-agent-on-windows.md" >}}) @@ -45,33 +45,15 @@ to the end of the `docker run` command: Note that using paths on your host machine must be exposed to the Docker container through a bind mount for the flags to work properly. -## Kubernetes install script +## Kubernetes manifests -Running this script automatically downloads and applies our recommended -Grafana Agent Kubernetes deployment manifests (requires `envsubst` (GNU gettext)). -Two manifests will be installed: one for collecting metrics, and the other for -collecting logs. You will be prompted for input for each manifest that is -applied. +If you wish to manually modify the Kubernetes manifests before deploying them, you can do so by downloading them from the [`kubernetes` directory](../../production/kubernetes/). Note that these manifests do not include Agent configuration files. For sample configuration, please see the Grafana Cloud Kubernetes quickstarts. -> **Warning:** Always verify scripts from the internet before running them. +## Grafana Cloud kubernetes quickstart guides -``` -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install.sh)" | kubectl -ndefault apply -f - -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install-loki.sh)" | kubectl apply -f - -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install-tempo.sh)" | kubectl apply -f - -``` - -**Note:** For the above script to scrape your pods, they must conform to the following rules: - -- The pod must _not_ have an annotation matching `prometheus.io/scrape: "false"` (this wouldn't be there unless you explicitly add it or if you deploy a Helm chart that has it). -- The pod _must_ have a port with a name ending in `-metrics`. This is the port that will be scraped by the Agent. A lot of people using Helm struggle with this, since Helm charts don't usually follow this. You would need to add a new scrape config to scrape helm charts or find a way to tweak the Helm chart to follow this rules. -- The pod _must_ have a label named name with any non-empty value. Helm usually lets you add extra labels, so this is less of a problem for Helm users. -- The pod must currently be running. (i.e., Kubernetes must not report it having a phase of Succeeded or Failed). - -## Kubernetes manifest +These guides help you get up and running with the Agent and Grafana Cloud, and include sample ConfigMaps. -If you wish to manually modify the Kubernetes manifest before deploying it -yourself, you can do so by downloading the [`agent.yaml` file](../../production/kubernetes/agent.yaml). +You can find them in the [Grafana Cloud documentation](https://grafana.com/docs/grafana-cloud/quickstart/agent-k8s/) ## Install locally diff --git a/production/README.md b/production/README.md index c2a6551377bb..0a62b6a5471a 100644 --- a/production/README.md +++ b/production/README.md @@ -1,30 +1,15 @@ # Running Grafana Agent -There are a few ways to run the Grafana Agent, in order from -easiest to hardest: +Here are some resources to help you run the Grafana Agent: -- [Use the Install Script for Kubernetes](#install-script-for-kubernetes) - [Windows Installation](#windows-installation) - [Run the Agent with Docker](#running-the-agent-with-docker) - [Run the Agent locally](#running-the-agent-locally) - [Use the example Kubernetes configs](#use-the-example-kubernetes-configs) +- [Grafana Cloud Kubernetes Quickstart Guides](#grafana-cloud-kubernetes-quickstart-guides) - [Build the Agent from Source](#build-the-agent-from-source) - [Use our production Tanka configs](#use-our-production-tanka-configs) -## Install Script for Kubernetes - -The Grafana Agent repository comes with installation scripts to -configure components and return a Kubernetes manifest that uses our preferred -defaults. To run the script, copy and paste this in your terminal: - -``` -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install.sh)" | kubectl apply -f - -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install-loki.sh)" | kubectl apply -f - -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install-tempo.sh)" | kubectl apply -f - -``` - -See the [Kubernetes README](./kubernetes/README.md) for more information. - ## Windows Installation To run the Windows Installation, download the Windows Installer executable from the [release page](https://github.com/grafana/agent/releases). Then run the installer, this will setup the Agent and run the Agent as a Windows Service. More details can be found in the [Windows Guide](../docs/getting-started/install-agent-on-windows.md) @@ -51,9 +36,13 @@ Agent as a long-living process (e.g., write your own systemd unit files). ## Use the example Kubernetes configs -The install script replaces variable placeholders in the [example Kubernetes -manifest](./kubernetes/agent.yaml) in the Kubernetes directory. Feel free to -examine that file and modify it for your own needs! +You can find sample deployment manifests in the [Kubernetes](./kubernetes) directory. + +## Grafana Cloud Kubernetes quickstart guides + +These guides help you get up and running with the Agent and Grafana Cloud, and include sample ConfigMaps. + +You can find them in the [Grafana Cloud documentation](https://grafana.com/docs/grafana-cloud/quickstart/agent-k8s/) ## Build the Agent from source diff --git a/production/kubernetes/README.md b/production/kubernetes/README.md index 53aa4d372d55..bff4e6189b35 100644 --- a/production/kubernetes/README.md +++ b/production/kubernetes/README.md @@ -1,50 +1,28 @@ # Kubernetes Config -This directory contains Kubernetes manifest templates and installation scripts -for rendering the templates so they can be applied against Kubernetes. +This directory contains Kubernetes manifest templates for rolling out the Agent. Manifests: -- Metric collection: [`agent.yaml`](./agent.yaml) -- Log collection: [`agent-loki.yaml`](./agent-loki.yaml) -- Trace collection: [`agent-tempo.yaml`](./agent-tempo.yaml) +- Metric collection (Deployment): [`agent-bare.yaml`](./agent-bare.yaml) +- Log collection (DaemonSet): [`agent-loki.yaml`](./agent-loki.yaml) +- Trace collection (DaemonSet): [`agent-tempo.yaml`](./agent-tempo.yaml) -Installation script: +These manifests do not include the Agent's configuration (ConfigMaps). -- Metric collection: [`install.sh`](./install.sh) -- Log collection: [`install-loki.sh`](./install-loki.sh) -- Trace collection: [`install-tempo.sh`](./install-tempo.sh) +For sample configurations and detailed installation instructions, please head to: -## Install Scripts - -There are two installation scripts, one for metrics and the other for logs. Each -install script does the following: - -1. Prmopts the user for their remote target credentials (Prometheus remote_write, Loki client). -2. Downloads the manifest template from GitHub -3. Substitutes variables in the template with the provided input from - step 1. -4. Prints out the final manifest to stdout without applying it. - -Here's a script to copy and paste to install the Agent on Kubernetes for -collecting metrics, logs, and traces (requires `envsubst` (GNU gettext)): - -``` -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install.sh)" | kubectl apply -f - -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install-loki.sh)" | kubectl apply -f - -NAMESPACE="default" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/kubernetes/install-tempo.sh)" | kubectl apply -f - -``` +- [Grafana Agent Metrics Kubernetes Quickstart](https://grafana.com/docs/grafana-cloud/quickstart/agent-k8s/k8s_agent_metrics/) +- [Grafana Agent Logs Kubernetes Quickstart](https://grafana.com/docs/grafana-cloud/quickstart/agent-k8s/k8s_agent_logs/) ## Manually Applying Since the manifest files are just templates, note that they are *not* ready for -applying out of the box and you will have to manually reroduce the steps that -the installation script does: +applying out of the box and you will have to manually perform the following steps: -1. Download the manifest as `manifest.yaml`. +1. Download the manifest as `manifest.yaml` -2. Modify your copy of the manifest, replacing all variables with the - appropriate values. +2. Modify your copy of the manifest, replacing relevant variables with the appropriate values 3. Apply the modified manifest file: `kubectl -ndefault apply -f manifest.yaml`. @@ -59,6 +37,7 @@ of software installed: 2. [`jsonnet-bundler`](https://github.com/jsonnet-bundler/jsonnet-bundler) >= v0.2.1 See the [`template` Tanka environment](./build/templates) for the current -settings that initialize the Grafana Agent Tanka configs. To build the YAML -file, execute the `./build/build.sh` script or run `make example-kubernetes` +settings that initialize the Grafana Agent Tanka configs. + +To build the YAML files, execute the `./build/build.sh` script or run `make example-kubernetes` from the project's root directory. diff --git a/production/kubernetes/agent-loki.yaml b/production/kubernetes/agent-loki.yaml index c785754ffd6b..cddee33ae8a0 100644 --- a/production/kubernetes/agent-loki.yaml +++ b/production/kubernetes/agent-loki.yaml @@ -2,271 +2,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: grafana-agent-logs - namespace: ${NAMESPACE} ---- -apiVersion: v1 -data: - agent.yaml: | - loki: - configs: - - clients: - - url: https://${LOKI_USERNAME}:${LOKI_PASSWORD}@${LOKI_HOSTNAME}/loki/api/v1/push - name: default - scrape_configs: - - job_name: kubernetes-pods-name - kubernetes_sd_configs: - - role: pod - pipeline_stages: - - docker: {} - relabel_configs: - - source_labels: - - __meta_kubernetes_pod_label_name - target_label: __service__ - - source_labels: - - __meta_kubernetes_pod_node_name - target_label: __host__ - - action: drop - regex: "" - source_labels: - - __service__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - action: replace - replacement: $1 - separator: / - source_labels: - - __meta_kubernetes_namespace - - __service__ - target_label: job - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - action: replace - source_labels: - - __meta_kubernetes_pod_name - target_label: pod - - action: replace - source_labels: - - __meta_kubernetes_pod_container_name - target_label: container - - replacement: /var/log/pods/*$1/*.log - separator: / - source_labels: - - __meta_kubernetes_pod_uid - - __meta_kubernetes_pod_container_name - target_label: __path__ - - job_name: kubernetes-pods-app - kubernetes_sd_configs: - - role: pod - pipeline_stages: - - docker: {} - relabel_configs: - - action: drop - regex: .+ - source_labels: - - __meta_kubernetes_pod_label_name - - source_labels: - - __meta_kubernetes_pod_label_app - target_label: __service__ - - source_labels: - - __meta_kubernetes_pod_node_name - target_label: __host__ - - action: drop - regex: "" - source_labels: - - __service__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - action: replace - replacement: $1 - separator: / - source_labels: - - __meta_kubernetes_namespace - - __service__ - target_label: job - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - action: replace - source_labels: - - __meta_kubernetes_pod_name - target_label: pod - - action: replace - source_labels: - - __meta_kubernetes_pod_container_name - target_label: container - - replacement: /var/log/pods/*$1/*.log - separator: / - source_labels: - - __meta_kubernetes_pod_uid - - __meta_kubernetes_pod_container_name - target_label: __path__ - - job_name: kubernetes-pods-direct-controllers - kubernetes_sd_configs: - - role: pod - pipeline_stages: - - docker: {} - relabel_configs: - - action: drop - regex: .+ - separator: "" - source_labels: - - __meta_kubernetes_pod_label_name - - __meta_kubernetes_pod_label_app - - action: drop - regex: '[0-9a-z-.]+-[0-9a-f]{8,10}' - source_labels: - - __meta_kubernetes_pod_controller_name - - source_labels: - - __meta_kubernetes_pod_controller_name - target_label: __service__ - - source_labels: - - __meta_kubernetes_pod_node_name - target_label: __host__ - - action: drop - regex: "" - source_labels: - - __service__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - action: replace - replacement: $1 - separator: / - source_labels: - - __meta_kubernetes_namespace - - __service__ - target_label: job - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - action: replace - source_labels: - - __meta_kubernetes_pod_name - target_label: pod - - action: replace - source_labels: - - __meta_kubernetes_pod_container_name - target_label: container - - replacement: /var/log/pods/*$1/*.log - separator: / - source_labels: - - __meta_kubernetes_pod_uid - - __meta_kubernetes_pod_container_name - target_label: __path__ - - job_name: kubernetes-pods-indirect-controller - kubernetes_sd_configs: - - role: pod - pipeline_stages: - - docker: {} - relabel_configs: - - action: drop - regex: .+ - separator: "" - source_labels: - - __meta_kubernetes_pod_label_name - - __meta_kubernetes_pod_label_app - - action: keep - regex: '[0-9a-z-.]+-[0-9a-f]{8,10}' - source_labels: - - __meta_kubernetes_pod_controller_name - - action: replace - regex: ([0-9a-z-.]+)-[0-9a-f]{8,10} - source_labels: - - __meta_kubernetes_pod_controller_name - target_label: __service__ - - source_labels: - - __meta_kubernetes_pod_node_name - target_label: __host__ - - action: drop - regex: "" - source_labels: - - __service__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - action: replace - replacement: $1 - separator: / - source_labels: - - __meta_kubernetes_namespace - - __service__ - target_label: job - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - action: replace - source_labels: - - __meta_kubernetes_pod_name - target_label: pod - - action: replace - source_labels: - - __meta_kubernetes_pod_container_name - target_label: container - - replacement: /var/log/pods/*$1/*.log - separator: / - source_labels: - - __meta_kubernetes_pod_uid - - __meta_kubernetes_pod_container_name - target_label: __path__ - - job_name: kubernetes-pods-static - kubernetes_sd_configs: - - role: pod - pipeline_stages: - - docker: {} - relabel_configs: - - action: drop - regex: "" - source_labels: - - __meta_kubernetes_pod_annotation_kubernetes_io_config_mirror - - action: replace - source_labels: - - __meta_kubernetes_pod_label_component - target_label: __service__ - - source_labels: - - __meta_kubernetes_pod_node_name - target_label: __host__ - - action: drop - regex: "" - source_labels: - - __service__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - action: replace - replacement: $1 - separator: / - source_labels: - - __meta_kubernetes_namespace - - __service__ - target_label: job - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - action: replace - source_labels: - - __meta_kubernetes_pod_name - target_label: pod - - action: replace - source_labels: - - __meta_kubernetes_pod_container_name - target_label: container - - replacement: /var/log/pods/*$1/*.log - separator: / - source_labels: - - __meta_kubernetes_pod_annotation_kubernetes_io_config_mirror - - __meta_kubernetes_pod_container_name - target_label: __path__ - positions_directory: /tmp/positions - server: - http_listen_port: 8080 - log_level: info -kind: ConfigMap -metadata: - name: grafana-agent-logs - namespace: ${NAMESPACE} + namespace: YOUR_NAMESPACE --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole @@ -301,13 +37,13 @@ roleRef: subjects: - kind: ServiceAccount name: grafana-agent-logs - namespace: ${NAMESPACE} + namespace: YOUR_NAMESPACE --- apiVersion: apps/v1 kind: DaemonSet metadata: name: grafana-agent-logs - namespace: ${NAMESPACE} + namespace: YOUR_NAMESPACE spec: minReadySeconds: 10 selector: diff --git a/production/kubernetes/agent-sigv4.yaml b/production/kubernetes/agent-sigv4.yaml deleted file mode 100644 index 62cc8366979d..000000000000 --- a/production/kubernetes/agent-sigv4.yaml +++ /dev/null @@ -1,348 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - annotations: - eks.amazonaws.com/role-arn: ${ROLE_ARN} - name: grafana-agent - namespace: ${NAMESPACE} ---- -apiVersion: v1 -data: - agent.yml: | - prometheus: - configs: - - host_filter: true - name: agent - remote_write: - - sigv4: - region: ${REGION} - url: ${REMOTE_WRITE_URL} - scrape_configs: - - job_name: kubernetes-pods - kubernetes_sd_configs: - - role: pod - relabel_configs: - - action: drop - regex: "false" - source_labels: - - __meta_kubernetes_pod_annotation_prometheus_io_scrape - - action: keep - regex: .*-metrics - source_labels: - - __meta_kubernetes_pod_container_port_name - - action: replace - regex: (https?) - replacement: $1 - source_labels: - - __meta_kubernetes_pod_annotation_prometheus_io_scheme - target_label: __scheme__ - - action: replace - regex: (.+) - replacement: $1 - source_labels: - - __meta_kubernetes_pod_annotation_prometheus_io_path - target_label: __metrics_path__ - - action: replace - regex: (.+?)(\:\d+)?;(\d+) - replacement: $1:$3 - source_labels: - - __address__ - - __meta_kubernetes_pod_annotation_prometheus_io_port - target_label: __address__ - - action: drop - regex: "" - source_labels: - - __meta_kubernetes_pod_label_name - - action: replace - replacement: $1 - separator: / - source_labels: - - __meta_kubernetes_namespace - - __meta_kubernetes_pod_label_name - target_label: job - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - action: replace - source_labels: - - __meta_kubernetes_pod_name - target_label: pod - - action: replace - source_labels: - - __meta_kubernetes_pod_container_name - target_label: container - - action: replace - separator: ':' - source_labels: - - __meta_kubernetes_pod_name - - __meta_kubernetes_pod_container_name - - __meta_kubernetes_pod_container_port_name - target_label: instance - - action: labelmap - regex: __meta_kubernetes_pod_annotation_prometheus_io_param_(.+) - replacement: __param_$1 - - action: drop - regex: Succeeded|Failed - source_labels: - - __meta_kubernetes_pod_phase - - job_name: ${NAMESPACE}/kube-state-metrics - kubernetes_sd_configs: - - namespaces: - names: - - ${NAMESPACE} - role: pod - relabel_configs: - - action: keep - regex: kube-state-metrics - source_labels: - - __meta_kubernetes_pod_label_name - - action: replace - separator: ':' - source_labels: - - __meta_kubernetes_pod_name - - __meta_kubernetes_pod_container_name - - __meta_kubernetes_pod_container_port_name - target_label: instance - - job_name: ${NAMESPACE}/node-exporter - kubernetes_sd_configs: - - namespaces: - names: - - ${NAMESPACE} - role: pod - relabel_configs: - - action: keep - regex: node-exporter - source_labels: - - __meta_kubernetes_pod_label_name - - action: replace - source_labels: - - __meta_kubernetes_pod_node_name - target_label: instance - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: kube-system/kubelet - kubernetes_sd_configs: - - role: node - relabel_configs: - - replacement: kubernetes.default.svc.cluster.local:443 - target_label: __address__ - - replacement: https - target_label: __scheme__ - - regex: (.+) - replacement: /api/v1/nodes/$1/proxy/metrics - source_labels: - - __meta_kubernetes_node_name - target_label: __metrics_path__ - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - insecure_skip_verify: false - - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: kube-system/cadvisor - kubernetes_sd_configs: - - role: node - metric_relabel_configs: - - action: drop - regex: container_([a-z_]+); - source_labels: - - __name__ - - image - - action: drop - regex: container_(network_tcp_usage_total|network_udp_usage_total|tasks_state|cpu_load_average_10s) - source_labels: - - __name__ - relabel_configs: - - replacement: kubernetes.default.svc.cluster.local:443 - target_label: __address__ - - regex: (.+) - replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor - source_labels: - - __meta_kubernetes_node_name - target_label: __metrics_path__ - scheme: https - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - insecure_skip_verify: false - global: - scrape_interval: 15s - wal_directory: /var/lib/agent/data - server: - log_level: info -kind: ConfigMap -metadata: - name: grafana-agent - namespace: ${NAMESPACE} ---- -apiVersion: v1 -data: - agent.yml: | - prometheus: - configs: - - host_filter: false - name: agent - remote_write: - - sigv4: - region: ${REGION} - url: ${REMOTE_WRITE_URL} - scrape_configs: - - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: default/kubernetes - kubernetes_sd_configs: - - role: endpoints - metric_relabel_configs: - - action: keep - regex: workqueue_queue_duration_seconds_bucket|process_cpu_seconds_total|process_resident_memory_bytes|workqueue_depth|rest_client_request_duration_seconds_bucket|workqueue_adds_total|up|rest_client_requests_total|apiserver_request_total|go_goroutines - source_labels: - - __name__ - relabel_configs: - - action: keep - regex: apiserver - source_labels: - - __meta_kubernetes_service_label_component - scheme: https - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - insecure_skip_verify: false - server_name: kubernetes - global: - scrape_interval: 15s - wal_directory: /var/lib/agent/data - server: - log_level: info -kind: ConfigMap -metadata: - name: grafana-agent-deployment - namespace: ${NAMESPACE} ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRole -metadata: - name: grafana-agent -rules: -- apiGroups: - - "" - resources: - - nodes - - nodes/proxy - - services - - endpoints - - pods - verbs: - - get - - list - - watch -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - name: grafana-agent -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: grafana-agent -subjects: -- kind: ServiceAccount - name: grafana-agent - namespace: ${NAMESPACE} ---- -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: grafana-agent - namespace: ${NAMESPACE} -spec: - minReadySeconds: 10 - selector: - matchLabels: - name: grafana-agent - template: - metadata: - labels: - name: grafana-agent - spec: - containers: - - args: - - -config.file=/etc/agent/agent.yml - - -prometheus.wal-directory=/tmp/agent/data - command: - - /bin/agent - env: - - name: HOSTNAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - image: grafana/agent:v0.16.1 - imagePullPolicy: IfNotPresent - name: agent - ports: - - containerPort: 80 - name: http-metrics - securityContext: - privileged: true - runAsUser: 0 - volumeMounts: - - mountPath: /etc/agent - name: grafana-agent - serviceAccount: grafana-agent - tolerations: - - effect: NoSchedule - operator: Exists - volumes: - - configMap: - name: grafana-agent - name: grafana-agent - updateStrategy: - type: RollingUpdate ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: grafana-agent-deployment - namespace: ${NAMESPACE} -spec: - minReadySeconds: 10 - replicas: 1 - revisionHistoryLimit: 10 - selector: - matchLabels: - name: grafana-agent-deployment - template: - metadata: - labels: - name: grafana-agent-deployment - spec: - containers: - - args: - - -config.file=/etc/agent/agent.yml - - -prometheus.wal-directory=/tmp/agent/data - command: - - /bin/agent - env: - - name: HOSTNAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - image: grafana/agent:v0.16.1 - imagePullPolicy: IfNotPresent - name: agent - ports: - - containerPort: 80 - name: http-metrics - securityContext: - privileged: true - runAsUser: 0 - volumeMounts: - - mountPath: /etc/agent - name: grafana-agent-deployment - serviceAccount: grafana-agent - volumes: - - configMap: - name: grafana-agent-deployment - name: grafana-agent-deployment diff --git a/production/kubernetes/agent.yaml b/production/kubernetes/agent.yaml deleted file mode 100644 index f3d297f53940..000000000000 --- a/production/kubernetes/agent.yaml +++ /dev/null @@ -1,348 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: grafana-agent - namespace: ${NAMESPACE} ---- -apiVersion: v1 -data: - agent.yml: | - prometheus: - configs: - - host_filter: true - name: agent - remote_write: - - basic_auth: - password: ${REMOTE_WRITE_PASSWORD} - username: ${REMOTE_WRITE_USERNAME} - url: ${REMOTE_WRITE_URL} - scrape_configs: - - job_name: kubernetes-pods - kubernetes_sd_configs: - - role: pod - relabel_configs: - - action: drop - regex: "false" - source_labels: - - __meta_kubernetes_pod_annotation_prometheus_io_scrape - - action: keep - regex: .*-metrics - source_labels: - - __meta_kubernetes_pod_container_port_name - - action: replace - regex: (https?) - replacement: $1 - source_labels: - - __meta_kubernetes_pod_annotation_prometheus_io_scheme - target_label: __scheme__ - - action: replace - regex: (.+) - replacement: $1 - source_labels: - - __meta_kubernetes_pod_annotation_prometheus_io_path - target_label: __metrics_path__ - - action: replace - regex: (.+?)(\:\d+)?;(\d+) - replacement: $1:$3 - source_labels: - - __address__ - - __meta_kubernetes_pod_annotation_prometheus_io_port - target_label: __address__ - - action: drop - regex: "" - source_labels: - - __meta_kubernetes_pod_label_name - - action: replace - replacement: $1 - separator: / - source_labels: - - __meta_kubernetes_namespace - - __meta_kubernetes_pod_label_name - target_label: job - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - action: replace - source_labels: - - __meta_kubernetes_pod_name - target_label: pod - - action: replace - source_labels: - - __meta_kubernetes_pod_container_name - target_label: container - - action: replace - separator: ':' - source_labels: - - __meta_kubernetes_pod_name - - __meta_kubernetes_pod_container_name - - __meta_kubernetes_pod_container_port_name - target_label: instance - - action: labelmap - regex: __meta_kubernetes_pod_annotation_prometheus_io_param_(.+) - replacement: __param_$1 - - action: drop - regex: Succeeded|Failed - source_labels: - - __meta_kubernetes_pod_phase - - job_name: ${NAMESPACE}/kube-state-metrics - kubernetes_sd_configs: - - namespaces: - names: - - ${NAMESPACE} - role: pod - relabel_configs: - - action: keep - regex: kube-state-metrics - source_labels: - - __meta_kubernetes_pod_label_name - - action: replace - separator: ':' - source_labels: - - __meta_kubernetes_pod_name - - __meta_kubernetes_pod_container_name - - __meta_kubernetes_pod_container_port_name - target_label: instance - - job_name: ${NAMESPACE}/node-exporter - kubernetes_sd_configs: - - namespaces: - names: - - ${NAMESPACE} - role: pod - relabel_configs: - - action: keep - regex: node-exporter - source_labels: - - __meta_kubernetes_pod_label_name - - action: replace - source_labels: - - __meta_kubernetes_pod_node_name - target_label: instance - - action: replace - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: kube-system/kubelet - kubernetes_sd_configs: - - role: node - relabel_configs: - - replacement: kubernetes.default.svc.cluster.local:443 - target_label: __address__ - - replacement: https - target_label: __scheme__ - - regex: (.+) - replacement: /api/v1/nodes/$1/proxy/metrics - source_labels: - - __meta_kubernetes_node_name - target_label: __metrics_path__ - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - insecure_skip_verify: false - - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: kube-system/cadvisor - kubernetes_sd_configs: - - role: node - metric_relabel_configs: - - action: drop - regex: container_([a-z_]+); - source_labels: - - __name__ - - image - - action: drop - regex: container_(network_tcp_usage_total|network_udp_usage_total|tasks_state|cpu_load_average_10s) - source_labels: - - __name__ - relabel_configs: - - replacement: kubernetes.default.svc.cluster.local:443 - target_label: __address__ - - regex: (.+) - replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor - source_labels: - - __meta_kubernetes_node_name - target_label: __metrics_path__ - scheme: https - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - insecure_skip_verify: false - global: - scrape_interval: 15s - wal_directory: /var/lib/agent/data - server: - log_level: info -kind: ConfigMap -metadata: - name: grafana-agent - namespace: ${NAMESPACE} ---- -apiVersion: v1 -data: - agent.yml: | - prometheus: - configs: - - host_filter: false - name: agent - remote_write: - - basic_auth: - password: ${REMOTE_WRITE_PASSWORD} - username: ${REMOTE_WRITE_USERNAME} - url: ${REMOTE_WRITE_URL} - scrape_configs: - - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: default/kubernetes - kubernetes_sd_configs: - - role: endpoints - metric_relabel_configs: - - action: keep - regex: workqueue_queue_duration_seconds_bucket|process_cpu_seconds_total|process_resident_memory_bytes|workqueue_depth|rest_client_request_duration_seconds_bucket|workqueue_adds_total|up|rest_client_requests_total|apiserver_request_total|go_goroutines - source_labels: - - __name__ - relabel_configs: - - action: keep - regex: apiserver - source_labels: - - __meta_kubernetes_service_label_component - scheme: https - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - insecure_skip_verify: false - server_name: kubernetes - global: - scrape_interval: 15s - wal_directory: /var/lib/agent/data - server: - log_level: info -kind: ConfigMap -metadata: - name: grafana-agent-deployment - namespace: ${NAMESPACE} ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRole -metadata: - name: grafana-agent -rules: -- apiGroups: - - "" - resources: - - nodes - - nodes/proxy - - services - - endpoints - - pods - verbs: - - get - - list - - watch -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - name: grafana-agent -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: grafana-agent -subjects: -- kind: ServiceAccount - name: grafana-agent - namespace: ${NAMESPACE} ---- -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: grafana-agent - namespace: ${NAMESPACE} -spec: - minReadySeconds: 10 - selector: - matchLabels: - name: grafana-agent - template: - metadata: - labels: - name: grafana-agent - spec: - containers: - - args: - - -config.file=/etc/agent/agent.yml - - -prometheus.wal-directory=/tmp/agent/data - command: - - /bin/agent - env: - - name: HOSTNAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - image: grafana/agent:v0.16.1 - imagePullPolicy: IfNotPresent - name: agent - ports: - - containerPort: 80 - name: http-metrics - securityContext: - privileged: true - runAsUser: 0 - volumeMounts: - - mountPath: /etc/agent - name: grafana-agent - serviceAccount: grafana-agent - tolerations: - - effect: NoSchedule - operator: Exists - volumes: - - configMap: - name: grafana-agent - name: grafana-agent - updateStrategy: - type: RollingUpdate ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: grafana-agent-deployment - namespace: ${NAMESPACE} -spec: - minReadySeconds: 10 - replicas: 1 - revisionHistoryLimit: 10 - selector: - matchLabels: - name: grafana-agent-deployment - template: - metadata: - labels: - name: grafana-agent-deployment - spec: - containers: - - args: - - -config.file=/etc/agent/agent.yml - - -prometheus.wal-directory=/tmp/agent/data - command: - - /bin/agent - env: - - name: HOSTNAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - image: grafana/agent:v0.16.1 - imagePullPolicy: IfNotPresent - name: agent - ports: - - containerPort: 80 - name: http-metrics - securityContext: - privileged: true - runAsUser: 0 - volumeMounts: - - mountPath: /etc/agent - name: grafana-agent-deployment - serviceAccount: grafana-agent - volumes: - - configMap: - name: grafana-agent-deployment - name: grafana-agent-deployment diff --git a/production/kubernetes/build/build.sh b/production/kubernetes/build/build.sh index 03cee41581ce..d7de7d3d8182 100644 --- a/production/kubernetes/build/build.sh +++ b/production/kubernetes/build/build.sh @@ -8,8 +8,6 @@ DIRNAME=$(dirname "$0") pushd "${DIRNAME}" || exit 1 # Make sure dependencies are up to date jb install -tk show --dangerous-allow-redirect ./templates/base > "${PWD}/../agent.yaml" -tk show --dangerous-allow-redirect ./templates/base-sigv4 > "${PWD}/../agent-sigv4.yaml" tk show --dangerous-allow-redirect ./templates/bare > "${PWD}/../agent-bare.yaml" tk show --dangerous-allow-redirect ./templates/loki > "${PWD}/../agent-loki.yaml" tk show --dangerous-allow-redirect ./templates/tempo > "${PWD}/../agent-tempo.yaml" diff --git a/production/kubernetes/build/templates/loki/main.jsonnet b/production/kubernetes/build/templates/loki/main.jsonnet index 3fef96484863..3290fe712bdf 100644 --- a/production/kubernetes/build/templates/loki/main.jsonnet +++ b/production/kubernetes/build/templates/loki/main.jsonnet @@ -2,18 +2,14 @@ local agent = import 'grafana-agent/v1/main.libsonnet'; { agent: - agent.new('grafana-agent-logs', '${NAMESPACE}') + + agent.new('grafana-agent-logs', 'YOUR_NAMESPACE') + agent.withConfigHash(false) + agent.withImages({ agent: (import 'version.libsonnet'), - }) + - agent.withLokiConfig(agent.scrapeKubernetesLogs) + - agent.withLokiClients( - agent.newLokiClient({ - scheme: 'https', - hostname: '${LOKI_HOSTNAME}', - username: '${LOKI_USERNAME}', - password: '${LOKI_PASSWORD}', - }) - ), -} + }) + agent.withLokiConfig(agent.scrapeKubernetesLogs) + { + agent+: { + // Remove ConfigMap + config_map:: {}, + }, + }, +} \ No newline at end of file diff --git a/production/kubernetes/install-loki.sh b/production/kubernetes/install-loki.sh deleted file mode 100644 index f5b5126bc5d9..000000000000 --- a/production/kubernetes/install-loki.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -# shellcheck shell=bash - -# -# install-loki.sh is a really basic installer for the agent. It uses the existing -# Kubernetes YAML example and envsubst to fill in the details for Loki write -# URL, username, and password. -# -# There are three ways to provide the inputs for installation: -# -# 1. Environment variables (LOKI_HOSTNAME, LOKI_USERNAME, LOKI_PASSWORD, -# NAMESPACE) -# -# 2. Flags (-h for hostname, -u for username, -p for password, -n namespace) -# -# 3. stdin from prompts -# -# Flags override environment variables, and stdin is used as a fallback if a -# value wasn't given from a flag or environment variable. An empty username -# or password is acceptable, as it disables basic auth. However, a hostname must -# always be provided. -# - -check_installed() { - if ! type "$1" >/dev/null 2>&1; then - echo "error: $1 not installed" >&2 - exit 1 - fi -} - -check_installed curl -check_installed envsubst - -MANIFEST_BRANCH=v0.16.1 -MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-loki.yaml} -NAMESPACE=${NAMESPACE:-default} - -LOKI_USERNAME_SET=0 -LOKI_PASSWORD_SET=0 - -while getopts "h:u:p:n:" opt; do - case "$opt" in - h) - LOKI_HOSTNAME=$OPTARG - ;; - u) - LOKI_USERNAME=$OPTARG - LOKI_USERNAME_SET=1 - ;; - p) - LOKI_PASSWORD=$OPTARG - LOKI_PASSWORD_SET=1 - ;; - n) - NAMESPACE=$OPTARG - ;; - ?) - echo "usage: $(basename "$0") [-h Loki hostname] [-u Loki username] [-p Loki password] [-n namespace]" >&2 - exit 1 - ;; - esac -done - -if [ -z "${LOKI_HOSTNAME}" ]; then - read -rsp 'Enter your Loki hostname (i.e., logs-us-central1.grafana.net): ' LOKI_HOSTNAME - printf $'\n' >&2 - - # We require a hostname for the agent; we don't do this same check for - # the username and password as the remote Loki system may not have basic - # auth enabled. - if [ -z "${LOKI_HOSTNAME}" ]; then - echo "error: LOKI_HOSTNAME must be provided by flag, env, or stdin" >&2 - exit 1 - fi -fi - -if [ -z "${LOKI_USERNAME}" ] && [ "${LOKI_USERNAME_SET}" -eq 0 ]; then - read -rsp 'Enter your Loki username: ' LOKI_USERNAME - printf $'\n' >&2 -fi - -if [ -z "${LOKI_PASSWORD}" ] && [ "${LOKI_PASSWORD_SET}" -eq 0 ]; then - read -rsp 'Enter your Loki password: ' LOKI_PASSWORD - printf $'\n' >&2 -fi - -export NAMESPACE -export LOKI_HOSTNAME -export LOKI_USERNAME -export LOKI_PASSWORD - -curl -fsSL "$MANIFEST_URL" | envsubst diff --git a/production/kubernetes/install-sigv4.sh b/production/kubernetes/install-sigv4.sh deleted file mode 100644 index dfc16de1e603..000000000000 --- a/production/kubernetes/install-sigv4.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash -# shellcheck shell=bash - -# -# install.sh is a really basic installer for the agent. It uses the existing -# Kubernetes YAML example and envsubst to fill in the details for remote write -# URL, username, and password. -# -# There are three ways to provide the inputs for installation: -# -# 1. Environment variables (REMOTE_WRITE_URL, REGION, ROLE_ARN, NAMESPACE) -# -# 2. Flags (-l for remote write URL, -n for namespace, -a for ARN, -r for region) -# -# 3. stdin from prompts -# -# Flags override environment variables, and stdin is used as a fallback if a -# value wasn't given from a flag or environment variable. An empty username -# or password is acceptable, as it disables basic auth. However, a remote write -# URL must always be provided. -# - -check_installed() { - if ! type "$1" >/dev/null 2>&1; then - echo "error: $1 not installed" >&2 - exit 1 - fi -} - -check_installed curl -check_installed envsubst - -MANIFEST_BRANCH=v0.16.1 -MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-sigv4.yaml} -NAMESPACE=${NAMESPACE:-default} -ROLE_ARN=${ROLE_ARN:-} - -while getopts "l:u:p:n:a:r:" opt; do - case "$opt" in - l) - REMOTE_WRITE_URL=$OPTARG - ;; - n) - NAMESPACE=$OPTARG - ;; - a) - ROLE_ARN=$OPTARG - ;; - r) - REGION=$OPTARG - ;; - ?) - echo "usage: $(basename "$0") [-l remote write url] [-n namespace]" >&2 - exit 1 - ;; - esac -done - -if [ -z "${REMOTE_WRITE_URL}" ]; then - read -rsp 'Enter your remote write URL: ' REMOTE_WRITE_URL - printf $'\n' >&2 - - if [ -z "${REMOTE_WRITE_URL}" ]; then - echo "error: REMOTE_WRITE_URL must be provided by flag, env, or stdin" >&2 - exit 1 - fi -fi - -if [ -z "${REGION}" ]; then - read -rsp 'Enter the remote write region: ' REGION - printf $'\n' >&2 - - if [ -z "${REGION}" ]; then - echo "error: REGION must be provided by flag, env, or stdin" >&2 - exit 1 - fi -fi - - -export NAMESPACE -export REMOTE_WRITE_URL -export ROLE_ARN -export REGION - -curl -fsSL "$MANIFEST_URL" | envsubst diff --git a/production/kubernetes/install-tempo.sh b/production/kubernetes/install-tempo.sh deleted file mode 100644 index aba6480a955c..000000000000 --- a/production/kubernetes/install-tempo.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -# shellcheck shell=bash - -# -# install-tempo.sh is a really basic installer for the agent. It uses the existing -# Kubernetes YAML example and envsubst to fill in the details for Tempo push -# URL, username, and password. -# -# There are three ways to provide the inputs for installation: -# -# 1. Environment variables (TEMPO_ENDPOINT, TEMPO_USERNAME, TEMPO_PASSWORD, -# NAMESPACE) -# -# 2. Flags (-e for endpoint, -u for username, -p for password, -n for namespace) -# -# 3. stdin from prompts -# -# Flags override environment variables, and stdin is used as a fallback if a -# value wasn't given from a flag or environment variable. An empty username -# or password is acceptable, as it disables basic auth. However, a hostname must -# always be provided. -# - -check_installed() { - if ! type "$1" >/dev/null 2>&1; then - echo "error: $1 not installed" >&2 - exit 1 - fi -} - -check_installed curl -check_installed envsubst - -MANIFEST_BRANCH=v0.16.1 -MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-tempo.yaml} -NAMESPACE=${NAMESPACE:-default} - -TEMPO_USERNAME_SET=0 -TEMPO_PASSWORD_SET=0 - -while getopts "e:u:p:n:" opt; do - case "$opt" in - e) - TEMPO_ENDPOINT=$OPTARG - ;; - u) - TEMPO_USERNAME=$OPTARG - TEMPO_USERNAME_SET=1 - ;; - p) - TEMPO_PASSWORD=$OPTARG - TEMPO_PASSWORD_SET=1 - ;; - n) - NAMESPACE=$OPTARG - ;; - ?) - echo "usage: $(basename "$0") [-e Tempo endpoint] [-u Tempo username] [-p Tempo password] [-n namespace]" >&2 - exit 1 - ;; - esac -done - -if [ -z "${TEMPO_ENDPOINT}" ]; then - read -rsp 'Enter your Tempo endpoint (i.e., tempo-us-central1.grafana.net): ' TEMPO_ENDPOINT - printf $'\n' >&2 - - # We require a endpoint for the agent; we don't do this same check for - # the username and password as the remote Tempo system may not have basic - # auth enabled. - if [ -z "${TEMPO_ENDPOINT}" ]; then - echo "error: TEMPO_ENDPOINT must be provided by flag, env, or stdin" >&2 - exit 1 - fi -fi - -if [ -z "${TEMPO_USERNAME}" ] && [ "${TEMPO_USERNAME_SET}" -eq 0 ]; then - read -rsp 'Enter your Tempo username: ' TEMPO_USERNAME - printf $'\n' >&2 -fi - -if [ -z "${TEMPO_PASSWORD}" ] && [ "${TEMPO_PASSWORD_SET}" -eq 0 ]; then - read -rsp 'Enter your Tempo password: ' TEMPO_PASSWORD - printf $'\n' >&2 -fi - -export NAMESPACE -export TEMPO_ENDPOINT -export TEMPO_USERNAME -export TEMPO_PASSWORD - -curl -fsSL "$MANIFEST_URL" | envsubst diff --git a/production/kubernetes/install.sh b/production/kubernetes/install.sh deleted file mode 100644 index 6ac1b2c10f62..000000000000 --- a/production/kubernetes/install.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env bash -# shellcheck shell=bash - -# -# install.sh is a really basic installer for the agent. It uses the existing -# Kubernetes YAML example and envsubst to fill in the details for remote write -# URL, username, and password. -# -# There are three ways to provide the inputs for installation: -# -# 1. Environment variables (NAMESPACE, REMOTE_WRITE_URL, REMOTE_WRITE_USERNAME, -# REMOTE_WRITE_PASSWORD) -# -# 2. Flags (-l for remote write URL, -u for remote write username, -p for remote -# write password, -n for namespace) -# -# 3. stdin from prompts -# -# Flags override environment variables, and stdin is used as a fallback if a -# value wasn't given from a flag or environment variable. An empty username -# or password is acceptable, as it disables basic auth. However, a remote write -# URL must always be provided. -# - -check_installed() { - if ! type "$1" >/dev/null 2>&1; then - echo "error: $1 not installed" >&2 - exit 1 - fi -} - -check_installed curl -check_installed envsubst - -MANIFEST_BRANCH=v0.16.1 -MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent.yaml} -NAMESPACE=${NAMESPACE:-default} - -REMOTE_WRITE_USERNAME_SET=0 -REMOTE_WRITE_PASSWORD_SET=0 - -while getopts "l:u:p:n:" opt; do - case "$opt" in - l) - REMOTE_WRITE_URL=$OPTARG - ;; - u) - REMOTE_WRITE_USERNAME=$OPTARG - REMOTE_WRITE_USERNAME_SET=1 - ;; - p) - REMOTE_WRITE_PASSWORD=$OPTARG - REMOTE_WRITE_PASSWORD_SET=1 - ;; - n) - NAMESPACE=$OPTARG - ;; - ?) - echo "usage: $(basename "$0") [-l remote write url] [-u remote write username] [-p remote write password] [-n namespace]" >&2 - exit 1 - ;; - esac -done - -if [ -z "${REMOTE_WRITE_URL}" ]; then - read -rsp 'Enter your remote write URL: ' REMOTE_WRITE_URL - printf $'\n' >&2 - - # We require a remote write URL for the agent; we don't do this same check for - # the username and password as the remote write system may not have basic - # auth enabled. - if [ -z "${REMOTE_WRITE_URL}" ]; then - echo "error: REMOTE_WRITE_URL must be provided by flag, env, or stdin" >&2 - exit 1 - fi -fi - -if [ -z "${REMOTE_WRITE_USERNAME}" ] && [ "${REMOTE_WRITE_USERNAME_SET}" -eq 0 ]; then - read -rsp 'Enter your remote write username: ' REMOTE_WRITE_USERNAME - printf $'\n' >&2 -fi - -if [ -z "${REMOTE_WRITE_PASSWORD}" ] && [ "${REMOTE_WRITE_PASSWORD_SET}" -eq 0 ]; then - read -rsp 'Enter your remote write password: ' REMOTE_WRITE_PASSWORD - printf $'\n' >&2 -fi - -export NAMESPACE -export REMOTE_WRITE_URL -export REMOTE_WRITE_USERNAME -export REMOTE_WRITE_PASSWORD - -curl -fsSL "$MANIFEST_URL" | envsubst