<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Maor Paz on Medium]]></title>
        <description><![CDATA[Stories by Maor Paz on Medium]]></description>
        <link>https://medium.com/@maorPaz?source=rss-654836d348fa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OSD8Kf1mruLPmIZG</url>
            <title>Stories by Maor Paz on Medium</title>
            <link>https://medium.com/@maorPaz?source=rss-654836d348fa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 00:15:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@maorPaz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Observability at Scale Across Multi-Cloud Environments]]></title>
            <link>https://medium.com/workday-engineering/observability-at-scale-across-multi-cloud-environments-7413d9063e14?source=rss-654836d348fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7413d9063e14</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[infrastructure]]></category>
            <dc:creator><![CDATA[Maor Paz]]></dc:creator>
            <pubDate>Wed, 13 Aug 2025 10:29:44 GMT</pubDate>
            <atom:updated>2025-08-13T10:29:44.188Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Managing observability for a SaaS platform deployed across multiple cloud accounts, regions, and environments presents significant complexity and operational challenges.</em></p><p><em>This deep-dive explores the architectural patterns and lessons learned transitioning to cloud-native orchestration. Monitoring challenges at huge scale with complex infrastructure operations requiring scalability and fault isolation.</em></p><p>By <a href="https://medium.com/u/654836d348fa">Maor Paz</a> with contributions from <a href="https://www.linkedin.com/in/tom-sender-44164a60/">Tom Sender</a> and <a href="https://www.linkedin.com/in/noamgu/">Noam Guy</a></p><h3>Introduction</h3><p>Building, deploying, and maintaining a SaaS service across multiple cloud accounts, regions, and environments isn’t for the faint of heart, especially when it comes to observability.</p><p>One of our biggest challenges @ HiredScore (Recently acquired by Workday) was building an observability system that could not only support our current regional<strong> </strong>workloads but also <strong>scale 20x</strong> within a year, without compromising performance, visibility, or operational sanity.</p><p>As a cloud engineer on the platform team, I’ve been deeply involved in our transition to a highly scalable model that provides the isolation and fault tolerance<strong> </strong>we need to operate globally, with most of our services running on Amazon EKS.</p><p>This setup introduced some unique challenges:</p><ul><li>How do you maintain visibility across independent environment while preserving their isolation?</li><li>How do you ensure alerts fire consistently without duplication or blind spots?</li><li>And most importantly, how do you design for massive scale from day one?</li></ul><p>In this post, I’ll walk you through our journey of building an <br>enterprise-grade observability solution.</p><h3>The starting point</h3><h4>Prometheus</h4><ul><li><strong>Short retention:</strong> Unsuitable for long-term trend analysis.</li><li><strong>Isolated instances:</strong> No native support for cross-cluster queries or centralization.</li><li><strong>Alerting tied to instance:</strong> If Prometheus goes down, <strong>alerts and scaling stopped.</strong></li></ul><h4>Thanos</h4><ul><li><strong>Complex architecture</strong>: Requires managing multiple components (sidecars, store, compactor, etc.).</li><li><strong>Slow long-range queries</strong>: Queries that hit object storage (S3/GCS) are latency-prone.</li><li><strong>Difficult ops at scale</strong>: Debugging and upgrades are operationally heavy and error-prone.</li></ul><h4>Grafana Manual Alerts</h4><ul><li><strong>No version control</strong>: Alerts created via UI can’t be tracked, reviewed, or rolled back.</li><li><strong>Tightly coupled to dashboards</strong>: Reuse across environments is manual and fragile.</li><li><strong>No testing or linting</strong>: Alert logic is edited live, often in production, with no validation.</li></ul><h3>The Business Case for Robust Observability</h3><p>In our environment, metrics aren’t just an operational nicety — they directly drive business outcomes. <br>Our autoscaling solutions rely on <a href="https://keda.sh/docs/1.4/scalers/prometheus/"><em>KEDA</em> <em>(Kubernetes Event-driven Autoscaling)</em></a>, which uses custom metrics to determine when to scale services.</p><p><strong>General metrics monitoring our business:</strong></p><ul><li>CPU</li><li>Memory</li><li>Network bottlenecks</li><li>OOM’s</li><li>Kubernetes infrastructure</li><li>Certificates</li></ul><p><strong>Key metrics driving our business include</strong></p><ul><li>Time in queue for processing tasks</li><li>Number of entities in the queue</li><li>HTTP request volume and latency</li></ul><p>When these metrics aren’t accurate or available, our scaling decisions become suboptimal, potentially impacting customer experience.</p><h3>Architectural Decisions</h3><p>After evaluating several solutions in the Prometheus ecosystem, we selected Victoria Metrics as our time-series database.</p><p><strong>VictoriaMetrics</strong> is a high-performance, cost-effective time series database (TSDB) built for ingesting, storing, and querying large amounts of time series data, like metrics from Prometheus, IoT devices, logs, etc.</p><p>This decision was driven by several key factors:</p><ul><li><strong>Storage efficiency —</strong> using approximately <a href="https://keda.sh/docs/1.4/scalers/prometheus/">7x less disk space and RAM than vanilla Prometheus</a></li><li><strong>Clustered mode</strong> — capabilities for horizontally scalable storage, without horizontal scalability, a single node would quickly become overwhelmed.</li><li><strong>Push and pull models — </strong><a href="https://docs.victoriametrics.com/keyconcepts/#raw-samples">support for both via <em>Victoria Metrics Agent</em> and scraping</a></li><li><strong>Built-in compression —</strong> This is a core design strength that Minimizes disk usage, enables efficient long-term retention, delivers fast performance even with huge datasets and lowers operational cost.</li></ul><p>We then designed a hybrid architecture that would be isolated while still providing centralized visibility:</p><ul><li><strong>Victoria Metrics Single </strong>runs on each data plane (cell) its own instance</li><li><strong>Victoria Metrics Agent</strong> for metric collection and writing into multiple targets</li><li><strong>Victoria Metrics Alert </strong>For alerting via various systems i.e, <em>AlertManager</em></li></ul><p>All components communicate via a carefully designed routing setup.</p><h3>The Solution: A Deep Dive</h3><p>Our architecture follows a hub-and-spoke model, with individual data planes (cells) acting as the spokes and a central control plane as the hub.<br>We are using the AWS known design pattern of Cell Architecture</p><blockquote><a href="https://docs.aws.amazon.com/wellarchitected/latest/reducing-scope-of-impact-with-cell-based-architecture/what-is-a-cell-based-architecture.html"><strong>AWS Cell Architecture</strong></a> is a design pattern that breaks infrastructure into independent, self-contained units called “cells”. Each cell contains all the resources needed to run a complete slice of the application — typically including compute, storage, networking, and observability components.</blockquote><h3>Data Plane Components</h3><p>Each <strong>data plane cluster</strong> is designed to operate independently, with lightweight and fast observability components close to the workloads.</p><ul><li><strong>VictoriaMetrics Single</strong> acts as the local metrics store. It’s optimized for speed, with a 24-hour retention period to support near real-time queries.</li><li><strong>KEDA</strong> leverages this local metrics store to make scaling decisions based on real-time application behavior.</li><li><strong>PrometheusRules </strong>(Details below) are evaluated locally, ensuring fast and reliable alerting at the edge without relying on the control plane.</li></ul><h3>Control Plane Components</h3><p>Our control plane provides the long-term, global view needed for observability at scale.</p><ul><li><strong>VictoriaMetrics Cluster</strong> stores metrics for 30 days, enabling root cause analysis over time, supporting Grafana dashboards, detecting long-term anomalies and drift, and providing visibility into trends or changes in service behavior.</li><li><strong>Alertmanager</strong> serves as the central hub for alert management, consolidating alert streams from all data planes into one place.</li><li><strong>Grafana</strong> for a global view of metrics across all cells, enabling our teams to visualize and understand the full system in real time.</li></ul><h3>Metrics and Alert Routing Design</h3><p>One of the key pillars of our architecture is how metrics and alerts flow through the system.</p><p>In each data plane, a VictoriaMetrics Agent scrapes local metrics and writes them to two destinations:</p><ol><li><strong>A local VictoriaMetrics Single</strong> instance for fast, low-latency access</li><li><strong>The control plane’s VictoriaMetrics Cluster</strong> for a centralized, long-term view</li></ol><p>This setup allows us to support real-time responsiveness and historical insight without compromising scale, reliability, and speed.</p><p>To handle alerting, VictoriaMetrics Alert pushes alerts from each data plane to the centralized Alertmanager in the control plane, securely connected via <a href="http://docs.aws.amazon.com/vpc/latest/privatelink/what-is-privatelink.html">AWS PrivateLink</a>. This design ensures alerts are still triggered at the edge but are centrally managed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6FmYR0OPvYqktftmrVxucg.png" /></figure><h3>Alert as Code Approaches</h3><p>One of our biggest challenges was standardizing how alerts are defined and managed across multiple cells. With dozens of environments, manually configuring alerts in each one would quickly lead to duplication<strong>, </strong>inconsistency, and operational pain.</p><p>Our solution? An <strong>“</strong>Alert as Code<strong>”</strong> approach — built on top of PrometheusRules (VMRules) rather than native Grafana alerts.<br>VictoriaMetrics supports the conversion of PrometheusRule into VMRule.</p><h3>Why PrometheusRules?</h3><p>By using Prometheus-style alert definitions, we unlock several key benefits:</p><ul><li><strong>Alerts are version-controlled</strong> and follow GitOps best practices</li><li><strong>A single alert definition</strong> can be deployed across all relevant environments</li><li>We used a <a href="https://prometheus.io/docs/prometheus/latest/command-line/promtool/"><strong>promtool</strong></a> CI to test and validate before going live for short &amp; fast feedback loops</li></ul><p>This not only streamlines alert management but also enforces consistency and reduces the chances of human error.<br>prometheusRule example:</p><pre>apiVersion: monitoring.coreos.com/v1<br>kind: PrometheusRule<br>metadata:<br>  name: cert-manager.rules<br>spec:<br>  groups:<br>    - name: cert-manager.rules<br>      rules:<br>        - alert: CertManagerAbsent<br>          expr: absent(up{job=&quot;cert-manager&quot;})<br>          for: 10m<br>          annotations:<br>            description: |<br>              New certificates will not be able to be minted, <br>              and existing ones can&#39;tbe renewed until cert-manager is back.<br>            runbook_url: https://Company.atlassian.net/wiki/spaces/TechOps/Cert-manager+alerts#CertManagerAbsent<br>            summary: Cert Manager has disappeared from Prometheus service discovery.<br>          labels:<br>            owner: ops<br>            severity: critical</pre><h3>Implementation Journey</h3><p>Our rollout followed a platform engineering mindset with a strong focus on user experience, feedback loops, and gradual adoption.</p><h4>Phase 1: Dogfooding</h4><p>We began by rolling out the observability stack for our platform team and group. This allowed us to iterate quickly, refine the tooling, and prove its value before asking others to adopt it.</p><h4>Phase 2: Champion Team Engagement</h4><p>Next, we partnered with a dedicated product team who became our first external user. Their fresh perspective helped surface edge cases and usability gaps that we hadn’t encountered internally.</p><h4>Phase 3: Education &amp; Enablement &amp; More Education</h4><p>After incorporating feedback, we focused on developer onboarding:</p><ul><li>Hands-on training sessions</li><li>Well-written documentation — Alert design, PromQL query library, how to add and modify alerts, run book and troubleshooting links when the alerts fires.</li><li>CI process to indicate whether the alert configured properly</li><li>Transparent communication of rollout timelines, essential to keep the team committed until the full transition</li><li>A dedicated HyperCare phase with a strong focus on migration support</li></ul><p>The goal was to make adoption frictionless and give teams confidence in the new system.</p><h4>Phase 4: Parallelism</h4><p>To build trust, we ran the new observability stack side by side with the legacy solution. This allowed teams to compare results and validate behavior before fully switching over.</p><h4>Phase 5: Closure</h4><p>Once all stakeholders were on board, we announced a deprecation date for the legacy stack and completed the migration across the organization.</p><h3>Key Benefits Realized</h3><p>Our observability architecture has delivered tangible, long-term value across several dimensions:</p><h4>Scalability</h4><p>We’ve already validated that the system can handle 10x our initial load with zero performance impact — and our benchmarks indicate readiness for <strong>20x growth</strong>.</p><h4>Flexibility</h4><p>If one data plane encounters issues, alerts still fire from the control plane, without affecting other environments.</p><h4>Performance</h4><p>Local VictoriaMetrics instances improve performance by executing queries close to the data, ensuring fast, low-latency responses for time-critical use cases like KEDA and alerts — without overloading shared or centralized infrastructure.</p><h3>Lessons Learned</h3><p>Throughout our journey, we picked up several key lessons that could benefit other teams pursuing large-scale observability initiatives:</p><h4>Start Early</h4><p>Observability isn’t an afterthought — it shapes your network architecture, your data flows, and your response strategy. Building it in from day one is far easier (and cleaner) than retrofitting it later.</p><h4>Embrace CNCF Standards</h4><p>Leaning into <a href="https://www.cncf.io/projects/">Cloud Native Computing Foundation (CNCF)</a> technologies gave us a strong, proven foundation. It also gave us access to a vibrant community and a mature tooling ecosystem.</p><h4>Separation with Integration</h4><p>Make sure components integrate well. Our <strong>cell-based approach</strong> ensures isolation while still enabling a unified, global view of system health.</p><h4>Code-First Approach</h4><p>Managing everything as code is <strong>crucial for consistency and scalability</strong>. It has enabled us to grow without scaling operational overhead linearly.</p><h4>Plan for Enterprise Scale</h4><p>Even if you’re not operating at enterprise scale today, <strong>design like you are</strong>. <a href="https://blog.workday.com/en-us/workday-acquisition-hiredscore-conversation-athena-karp.html">When we joined Workday</a>, we had to completely refactor and redesign our entire infrastructure — monitoring was just one small piece of that transformation.</p><h3>Future Roadmap</h3><p>While our current setup meets our core requirements, we’re continuing to evolve our observability stack:</p><ul><li><strong>Dashboards as Code</strong>: Applying GitOps to Grafana.</li><li><strong>Enhanced Correlation</strong>: Better linking between metrics, logs, and traces.</li><li><strong>Expanded Business Metrics</strong>: Bringing more KPIs into our dashboards.</li><li><strong>CI with AI: </strong>Integrate AI capabilities into your workflow — whenever a new alert is added, automatically analyze its expression and suggest improvements.</li><li><strong>Advanced Alerting</strong>: Moving toward anomaly detection and intelligent alerting.</li></ul><h3>Final Thoughts</h3><p>If you’re embarking on a similar journey, here are three guiding principles I recommend:</p><ol><li><strong>Design for your future scale</strong>, not just your current needs.</li><li><strong>Manage observability as code</strong> to stay consistent and reduce toil.</li><li><strong>Maintain isolation without sacrificing visibility</strong> through smart routing and dual-target strategies.</li></ol><p>These principles helped us scale observability across regions, teams, and demands — and they continue to guide us as we move forward.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7413d9063e14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/workday-engineering/observability-at-scale-across-multi-cloud-environments-7413d9063e14">Observability at Scale Across Multi-Cloud Environments</a> was originally published in <a href="https://medium.com/workday-engineering">Workday Technology Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secrets are everywhere]]></title>
            <link>https://medium.com/@maorPaz/secrets-are-everywhere-6400bbe8e894?source=rss-654836d348fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/6400bbe8e894</guid>
            <category><![CDATA[kubernetes-security]]></category>
            <category><![CDATA[external-secrets]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[devops-tool]]></category>
            <category><![CDATA[gitops]]></category>
            <dc:creator><![CDATA[Maor Paz]]></dc:creator>
            <pubDate>Sun, 17 Sep 2023 18:27:50 GMT</pubDate>
            <atom:updated>2024-08-10T18:04:13.459Z</atom:updated>
            <content:encoded><![CDATA[<p>Nowdays, everything needs to scale, and sync automatically, GitOps, single-source-of-truth, and on top of it, <strong>SECURITY.</strong></p><p>TL;DR, external secrets along with GCP secret manager on Kubernetes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HoQvhOc2x2hbLAKT" /><figcaption>Photo by <a href="https://unsplash.com/@beemagic275?utm_source=medium&amp;utm_medium=referral">Nguyễn Phúc</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>The challenge:</strong></p><p>You are using Kubernetes to orchestrate your microservices, <br>some of the microservices need secrets in order to operate, such as:</p><ul><li>Tokens.</li><li>TLS certificates.</li><li>Container registries cresentials.</li><li>Database connection strings.</li></ul><p>And many more.<br>You probably end up with several Kubernetes clusters and a lot of secrets to manage.</p><p>You may want to manage your manifests on some sort of SCM.</p><p>What if we can store all Kubernetes types of secrets in a single place? And then fetch them using an API call?</p><p>There are several tools that allow you to pull/push secrets with a single API call:</p><ol><li><a href="https://www.akeyless.io/?kw=akeyless&amp;cpn=17545768448&amp;utm_term=akeyless&amp;utm_campaign=Global_Search_Brand_Akeyless&amp;utm_source=adwords&amp;utm_medium=ppc&amp;hsa_acc=1474601964&amp;hsa_cam=17545768448&amp;hsa_grp=140931133834&amp;hsa_ad=604996049652&amp;hsa_src=g&amp;hsa_tgt=kwd-1675230348641&amp;hsa_kw=akeyless&amp;hsa_mt=e&amp;hsa_net=adwords&amp;hsa_ver=3&amp;gad=1&amp;gclid=Cj0KCQjwx5qoBhDyARIsAPbMagC_6oHCVrvGjf0ToVSERf04_zBFtkqbKTYf0-zZelKGEPOZGjoIOQwaAkTqEALw_wcB">Akeyless</a></li><li><a href="https://www.vaultproject.io/">HC Vault</a></li><li><a href="https://cloud.google.com/secret-manager">GCP secret manager</a></li><li>Cloud provider solution</li><li><a href="https://aws.amazon.com/secrets-manager/">AWS Secrets Manager</a></li><li><a href="https://azure.microsoft.com/en-us/products/key-vault">Azure Key Vault</a></li></ol><p>And others.</p><p>Since I currently use GCP as the cloud provider to orchestrate applications, I decided to go with GCP secret manager.</p><p>Easy to start (Just enable API) and then you are ready to go, right!?<br>Not so fast,</p><p>There are a lot of tools out there that can fetch secrets from the providers I mentioned earlier, but the most fit for our needs on the day writing this article was the <strong>External Secrets Operator</strong></p><p>I wanted a solution to store <strong>secrets that are shared </strong>for all our Kubernetes clusters<strong>.</strong></p><p>My strategy that I was taking was to create 2 GCP projects:</p><ol><li>GCP Project to hold all <strong>shared secrets</strong>.</li><li>GCP Project to hold the actual workload called <strong>dev</strong>.</li></ol><p>The first project does not run any workload, <br>it’s designed to be shared for all other projects in GCP.</p><p>In the <strong>shared secrets project, </strong>I just enabled the API of secret-manager of GCP via Terraform:</p><pre>resource &quot;google_project&quot; &quot;shared-secrets-poject&quot; {<br>  name                = &lt;shared-secrets&gt;<br>  project_id          = &lt;shared-secrets&gt;<br>  org_id              = var.project_org_id<br>  folder_id           = var.project_folder_id<br>  billing_account     = var.billing_account<br>  auto_create_network = var.auto_create_network<br><br>  labels = var.labels<br>}<br><br>resource &quot;google_project_service&quot; &quot;shared-resources-secretmanager&quot; {<br>  project = google_project.shared-resources-poject.project_id<br>  service = &quot;secretmanager.googleapis.com&quot;<br>}</pre><p>After this step, you can start uploading your secrets to GCP secret-manager.</p><p>I recommend enabling the API of the secret manager of GCP for both of the projects:</p><p>one project shared,<br>another project will store secrets for environment-specific workloads.</p><p>I’m using JSON to upload secrets since it’s easier to interact and extract data from it.</p><pre>gcloud secrets create mysecret --data-file=- &lt;&lt;&lt;&#39;{&quot;PASSWORD&quot;:&quot;mylastname&quot;,&quot;TOKEN&quot;:&quot;t0k3n&quot;}&#39;</pre><p>After confirmation that the secret created, let&#39;s try to fetch it:</p><pre>gcloud secrets versions access latest --secret mysecret | jq -r</pre><p>The output should be like:</p><pre>{<br>  &quot;PASSWORD&quot;: &quot;mylastname&quot;,<br>  &quot;TOKEN&quot;: &quot;t0k3n&quot;<br>}</pre><p>Now we see our secret is stored on GCP secret-manager.</p><p>To start using it with the External-Secrets operator, on the other project, (Dev project) I created permissions for the Google service account and attached it to the Kubernetes service account:</p><pre>locals {<br>  ## Define GCP roels for External-secrets service account<br>  roles = [<br>    &quot;roles/secretmanager.secretAccessor&quot;,<br>    &quot;roles/iam.serviceAccountTokenCreator&quot;<br>  ]<br><br># Define roles and SA<br>resource &quot;google_service_account&quot; &quot;es-workload-identity-user-sa&quot; {<br>  account_id   = &quot;external-secrets-sa&quot;<br>  display_name = &quot;Service Account For Workload Identity of external-secrets&quot;<br>}<br># Add roles the the service account of external-secrets<br>resource &quot;google_project_iam_member&quot; &quot;cluster_service_account_members&quot; {<br>  for_each = toset(compact(distinct(concat(local.roles))))<br>  role    = each.value<br>  member  = &quot;serviceAccount:${google_service_account.es-workload-identity-user-sa.email}&quot;<br>}<br><br>#### This is for the other project you want to fetch secrets from<br># Set the workload identity<br>resource &quot;google_project_iam_member&quot; &quot;workload-identity-role&quot; {<br>  role    = &quot;roles/iam.workloadIdentityUser&quot;<br>  member  = &quot;serviceAccount:${var.project_id}.svc.id.goog[external-secrets/external-secrets]&quot;<br>}</pre><p>Installing the external-secrets operator like so:</p><pre>helm repo add external-secrets https://charts.external-secrets.io<br><br>helm upgrade -i external-secrets \<br>external-secrets/external-secrets \<br>--set serviceAccount.name=&quot;external-secrets&quot; \<br>--set serviceAccount.annotations.iam\.gke\.io/gcp-service-account=&quot;external-secrets-sa&quot; \<br>-n external-secrets \<br>--create-namespace</pre><p>Now External-Secrets operator is ready to use,</p><p>It’s time to create the first ClusterSecretStore for external-secrets:</p><blockquote>The ClusterSecretStore is a cluster-scoped SecretStore that can be referenced by all ExternalSecrets from all namespaces</blockquote><p>We are just letting the external-secrets information that we would like to fetch secrets from GCP:</p><pre>cat &lt;&lt;EOF | kubectl create -f - -n external-secrets<br>apiVersion: external-secrets.io/v1beta1<br>kind: ClusterSecretStore<br>metadata:<br>  name: local-secrets<br>spec:<br>  provider:<br>    gcpsm:<br>      projectID: &lt;Dev project secrets&gt;<br>---<br>apiVersion: external-secrets.io/v1beta1<br>kind: ClusterSecretStore<br>metadata:<br>  name: global-secrets<br>spec:<br>  provider:<br>    gcpsm:<br>      projectID: &lt;Shared project secrets&gt;<br>EOF<br></pre><p>Now the secrets are ready to be fetched:</p><pre> cat &lt;&lt;EOF | kubectl create -f -<br>apiVersion: external-secrets.io/v1beta1<br>kind: ExternalSecret<br>metadata:<br>  name: mysecret<br>spec:<br>  refreshInterval: 24h<br>  secretStoreRef:<br>    kind: ClusterSecretStore<br>    name: global-secrets<br>  target:<br>    name: mysecret<br>  dataFrom:<br>    - extract:<br>        key: mysecret<br>EOF</pre><p>We just made a request from the external-secrets to fetch a secret from the shared-secrets project.</p><p>Let’s check the result:</p><pre>kubectl get secrets mysecret -o yaml</pre><p>The Result should be similar to this:</p><pre>apiVersion: v1<br>data:<br>  PASSWORD: bXlsYXN0bmFtZQ==<br>  TOKEN: dDBrM24=<br>immutable: false<br>kind: Secret<br>  name: mysecret<br>  namespace: default<br>type: Opaque</pre><p>Here we can see our secrets, nicely encoded and extracted from the GCP secret-manager.</p><p>There are a lot of solutions out there to store, fetch, rotate, and manage the lifecycle of a secret for Kubernetes.</p><p>As a GitOps way of thought, this solution can make it’s benefit, since it’s secured by Google, and no sensitive information is being pushed to SCM.</p><p>Stay Cool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6400bbe8e894" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate addition cluster to ArgoCD fleet management]]></title>
            <link>https://medium.com/@maorPaz/add-cluster-to-argocd-fleet-management-eb2fd59fa479?source=rss-654836d348fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb2fd59fa479</guid>
            <category><![CDATA[argo-cd]]></category>
            <category><![CDATA[gitops]]></category>
            <category><![CDATA[external-secrets]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Maor Paz]]></dc:creator>
            <pubDate>Sat, 16 Sep 2023 11:15:13 GMT</pubDate>
            <atom:updated>2023-09-16T11:32:42.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*raGlACFlPFafvaAlTs4cyA.jpeg" /></figure><p>These days, we can’t even imagine our life without GitOps terms and managing multiple clusters, We have a solution to manage applications using ArgoCD, but how we can automate the process of adding clusters in GitOps way?</p><p>ArgoCD is able and designed to manage multiple clusters.</p><p>To add a new cluster of Kubernetes under the management of ArgoCD, you will need to provide information:<br>1. CA certificate<br>2. BarrerToken<br>3. Address of the cluster</p><p>of the cluster you want to add:</p><pre>argocd cluster add myDemoCluster --name &lt;DisplayName&gt; --kube-context &lt;NamefromKubeConfig&gt;</pre><p>This will add a new cluster to ArgoCD, and now we have two cluster connected to it, One cluster where ArgoCD lives and the cluster we just added.</p><p>But where is the automation when we add a new cluster and we want ArgoCD to add a cluster dynamically?</p><p>In this demo, I’ll demonstrate how you can easily add a Kubernetes cluster</p><p>For this kind of automation, I’ll use GCP as the cloud provider, to host the Kubernetes clusters and GCP secret manager to for secrets.</p><p>I’ll set up 2 clusters, one to host ArgoCD</p><p>and one cluster to be managed by ArgoCD.</p><p>In the cluster of ArgoCD, I’ll also install an external secrets service to automate the process of adding Clusters to Argo.</p><p>summarize all the tools being used:</p><ol><li>Kubernetes.</li><li>Helm.</li><li>Terraform.</li><li>GCP cloud provider.</li><li>GCP Secret Manager.</li><li>External-Secrets operator.</li><li>Bash.</li></ol><p>First, on the host Kubernetes install ArgoCD by using helm:</p><pre>helm repo add argo https://argoproj.github.io/argo-helm<br><br>helm upgrade -i argocd argo/argo-cd \<br>-n argocd \<br>--create-namespace</pre><p>Since we are running on GCP as the cloud provider, we can use it’s benefit and use GCP secret-manager, to store details in the cluster we want to manage.</p><p>It can be other projects in GCP or within the same project, please note you are giving the right access when using it.</p><p>it’s also recommended to use GCP workload identity. It lets the ability pods authenticate GCP services via IAM roles.</p><p>On the host cluster, where ArgoCD is installed make sure you enable the GCP workload identity feature,</p><p>Create a GCP service account for external secrets.</p><p>here is a terraform block you can use:</p><pre>locals {<br>  ## Define GCP roels for External-secrets service account<br>  roles = [<br>    &quot;roles/secretmanager.secretAccessor&quot;,<br>    &quot;roles/iam.serviceAccountTokenCreator&quot;<br>  ]<br><br># Define roles and SA<br>resource &quot;google_service_account&quot; &quot;es-workload-identity-user-sa&quot; {<br>  account_id   = &quot;external-secrets-sa&quot;<br>  display_name = &quot;Service Account For Workload Identity of external-secrets&quot;<br>}<br># Add roles the the service account of external-secrets<br>resource &quot;google_project_iam_member&quot; &quot;cluster_service_account_members&quot; {<br>  for_each = toset(compact(distinct(concat(local.roles))))<br>  project = var.project_id<br>  role    = each.value<br>  member  = &quot;serviceAccount:${google_service_account.es-workload-identity-user-sa.email}&quot;<br>}<br><br>#### This is in case your GCP secret-manager will store cluster details<br># Set the workload identity<br>resource &quot;google_project_iam_member&quot; &quot;workload-identity-role&quot; {<br>  role    = &quot;roles/iam.workloadIdentityUser&quot;<br>  member  = &quot;serviceAccount:${var.project_id}.svc.id.goog[external-secrets/external-secrets]&quot;<br>  project = var.project_id<br>}</pre><p>Install the External-secrets operator on the host Kubernetes, next to ArgoCD by using helm:</p><pre>helm repo add external-secrets https://charts.external-secrets.io<br><br>helm upgrade -i external-secrets \<br>external-secrets/external-secrets \<br>--set serviceAccount.name=&quot;external-secrets&quot; \<br>--set serviceAccount.annotations.iam\.gke\.io/gcp-service-account=&quot;external-secrets-sa&quot; \<br>-n external-secrets \<br>--create-namespace</pre><p>We just attached the GCP service account to the service account in the Kubernetes cluster and it will be in use by the external secrets operator.</p><p>Continue by adding the details of the hosted Kubernetes cluster to the GCP secret manager so it will be pulled by the external secrets operator.</p><p>you can fetch the cluster details like so:</p><pre>data &quot;google_client_config&quot; &quot;current&quot; {}<br><br>data &quot;google_container_cluster&quot; &quot;cluster&quot; {<br>  name     = var.cluster_name      # The cluster name that should be joined to ArgoCD<br>  location = var.region            # The cluster region that should be joined to ArgoCD<br>  project  = var.project_id        # The cluster project that should be joined to ArgoCD<br>}<br><br>resource &quot;google_secret_manager_secret&quot; &quot;gke-cluster-details&quot; {<br>  project = local.ARGO_PROJECT            # Store the secret in Argo Project<br>  secret_id = &quot;&lt;ManagedClusterName&gt;&quot;      # The cluster name should be joined to ArgoCD<br>  replication {<br>    automatic = true<br>  }<br>}<br><br>resource &quot;google_secret_manager_secret_version&quot; &quot;gke-cluster-details-values&quot; {<br>  secret = google_secret_manager_secret.gke-cluster-details.id<br>  secret_data =  jsonencode(<br>    {<br>      &quot;caData&quot;: data.google_container_cluster.cluster.master_auth.0.cluster_ca_certificate,   # The cluster CA that should be joined to ArgoCD must be encoded<br>      &quot;host&quot;: &quot;https://${data.google_container_cluster.cluster.endpoint}&quot;,                    # The cluster endpoint (Address) that should be joined to ArgoCD<br>      &quot;clusterName&quot;: data.google_container_cluster.cluster.name                               # The cluster project that should be joined to ArgoCD<br>    }<br>  )<br>}</pre><p>By running this terraform block, a new secret will be created in the GCP secret manager and it can be pulled by our external secrets operator</p><p>** If you getting an error regarding this Terraform it means you didn’t enable the API of GCP for secret manager: <br>(You can achieve it also with Terraform)</p><pre>gcloud services enable secretmanager.googleapis.com</pre><p>Now it’s time to apply the YAML manifest to Kubernetes where external secrets are installed.<br>(This tells the external-secrets operator that we using GCP as the secret manager, it can be any other, HC Vault, Akeyless, AWS, etc.)</p><pre>cat &lt;&lt;EOF | kubectl create -f - -n external-secrets<br>apiVersion: external-secrets.io/v1beta1<br>kind: ClusterSecretStore<br>metadata:<br>  name: gcp-secrets<br>spec:<br>  provider:<br>    gcpsm:<br>      projectID: &lt;projectID&gt; # Put here the same ProjectID where the secret lives<br>EOF</pre><p>Now we can refer to the secret name in GCP and extract the data required by ArgoCD:</p><pre>cat &lt;&lt;EOF | kubectl create -f - -n argocd<br>apiVersion: external-secrets.io/v1beta1<br>kind: ExternalSecret<br>metadata:<br>  name: ClusterName # For name convention, put here the hosted cluster<br>  namespace: argo<br>spec:<br>  secretStoreRef:<br>    name: gcp-secrets<br>    kind: ClusterSecretStore<br>  target:<br>    name: ClusterName # For name convention, put here the hosted cluster<br>    creationPolicy: &#39;Owner&#39;<br>    template:<br>      type: Opaque<br>      metadata:<br>        labels:<br>          argocd.argoproj.io/secret-type: cluster # This will make ArgoCD look on it<br>          environment: dev<br>      data:<br>        name: &quot;{{ .clusterName }}&quot;<br>        server: &quot;{{ .host }}&quot;<br>        config: |<br>          {<br>            &quot;execProviderConfig&quot;: {<br>              &quot;command&quot;: &quot;argocd-k8s-auth&quot;,<br>              &quot;args&quot;: [&quot;gcp&quot;],<br>              &quot;apiVersion&quot;: &quot;client.authentication.k8s.io/v1beta1&quot;<br>            },<br>            &quot;tlsClientConfig&quot;: {<br>              &quot;insecure&quot;: false,<br>              &quot;caData&quot;: &quot;{{ .caData }}&quot;<br>            }<br>          }<br>  data:<br>    - secretKey: clusterName<br>      remoteRef:<br>        key: &lt;GCP secret Manager Secret Name&gt;<br>        property: clusterName<br>    <br>    - secretKey: host<br>      remoteRef:<br>        key: &lt;GCP secret Manager Secret Name&gt;<br>        property: host<br>    <br>    - secretKey: caData<br>      remoteRef:<br>        key: &lt;GCP secret Manager Secret Name&gt;<br>        property: caData<br>        decodingStrategy: None<br>EOF</pre><p>Now The cluster should be automatically added to your Argo, <br>For GitOps and full automation, you may think of adding clusters and removing themes by using SCM.</p><p>Note, <br>The hosted Kubernetes cluster should be able to receive connection requests from the host ArgoCD,</p><p>if your cluster API is available only from a private network, you might want to use a private connection (GCP connect gateway.)</p><p>Cheers</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb2fd59fa479" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>