<?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 Kavinda Samarawickkrama on Medium]]></title>
        <description><![CDATA[Stories by Kavinda Samarawickkrama on Medium]]></description>
        <link>https://medium.com/@kavindasamarawickkrama2001?source=rss-d82a0226d57e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*l3HYKXi0IZos_bTvhujUrg.jpeg</url>
            <title>Stories by Kavinda Samarawickkrama on Medium</title>
            <link>https://medium.com/@kavindasamarawickkrama2001?source=rss-d82a0226d57e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:12:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kavindasamarawickkrama2001/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[Keycloak: An Open-Source Identity and Access Management Solution]]></title>
            <link>https://medium.com/@kavindasamarawickkrama2001/keycloak-an-open-source-identity-and-access-management-solution-7c0ae482988b?source=rss-d82a0226d57e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c0ae482988b</guid>
            <dc:creator><![CDATA[Kavinda Samarawickkrama]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 16:01:47 GMT</pubDate>
            <atom:updated>2025-12-25T16:01:47.634Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jEWEIDgX_xHVUhkq4LOf_w.png" /></figure><h3>Introduction</h3><p>In modern software systems, especially those built using microservices and cloud-native architectures, managing authentication and authorization securely is a critical challenge. <strong>Keycloak</strong> is an open-source <strong>Identity and Access Management (IAM)</strong> solution that simplifies this challenge by providing centralized user management, authentication, and authorization services.</p><p>Developed by Red Hat, Keycloak helps organizations secure applications and services with minimal effort while supporting industry-standard security protocols.</p><h3>What is Keycloak?</h3><p>Keycloak is an <strong>open-source IAM platform</strong> that enables developers to add authentication and authorization to applications without having to build these features from scratch. It acts as a centralized authentication server that manages users, roles, permissions, and sessions across multiple applications.</p><p>Keycloak supports both <strong>web applications</strong> and <strong>REST APIs</strong>, making it suitable for enterprise systems, cloud platforms, and distributed architectures.</p><h3>Core Features of Keycloak</h3><h3>1. Single Sign-On (SSO)</h3><p>Keycloak provides <strong>Single Sign-On</strong>, allowing users to authenticate once and access multiple applications without logging in repeatedly. This improves user experience and reduces password fatigue.</p><h3>2. User and Role Management</h3><p>Keycloak offers a built-in admin console to:</p><ul><li>Create and manage users</li><li>Assign roles and groups</li><li>Define fine-grained permissions</li><li>Manage user attributes and credentials</li></ul><h3>3. Standard Protocol Support</h3><p>Keycloak supports widely adopted authentication and authorization standards:</p><ul><li>OAuth 2.0</li><li>OpenID Connect (OIDC)</li><li>SAML 2.0</li></ul><p>This ensures easy integration with modern applications and third-party identity providers.</p><h3>4. Identity Federation</h3><p>Keycloak can integrate with external identity providers such as:</p><ul><li>Google</li><li>GitHub</li><li>LDAP and Active Directory</li><li>Other OIDC or SAML providers</li></ul><p>This allows users to log in using existing credentials instead of creating new accounts.</p><h3>5. Token-Based Security</h3><p>Keycloak issues <strong>JSON Web Tokens (JWTs)</strong> for authenticated users. These tokens are commonly used to secure REST APIs and microservices, enabling stateless authentication and scalability.</p><h3>6. Customizable Authentication Flows</h3><p>Authentication flows in Keycloak are highly configurable. Developers can implement:</p><ul><li>Multi-factor authentication (MFA)</li><li>Password policies</li><li>Conditional login rules</li><li>Custom authenticators</li></ul><h3>7. Built-in Security Features</h3><p>Keycloak includes essential security mechanisms such as:</p><ul><li>Brute-force attack detection</li><li>Session management</li><li>Password hashing and rotation</li><li>Account lockout policies</li></ul><h3>Keycloak Architecture</h3><p>At a high level, Keycloak consists of:</p><ul><li><strong>Realm</strong>: A security domain that manages users, roles, and clients.</li><li><strong>Clients</strong>: Applications or services secured by Keycloak.</li><li><strong>Users</strong>: End-users who authenticate to the system.</li><li><strong>Roles &amp; Groups</strong>: Authorization mechanisms defining access control.</li><li><strong>Tokens</strong>: Access tokens, refresh tokens, and ID tokens issued after authentication.</li></ul><p>Keycloak typically runs as a standalone server or within containers (Docker/Kubernetes), backed by a relational database.</p><h3>Common Use Cases</h3><ul><li>Securing microservices and APIs</li><li>Centralized authentication for enterprise applications</li><li>Implementing Single Sign-On across multiple systems</li><li>Managing users and roles for cloud-native applications</li><li>Integrating social login or enterprise identity providers</li></ul><h3>Advantages of Using Keycloak</h3><ul><li>Open-source and free</li><li>Reduces development effort for security features</li><li>Strong community and enterprise backing by Red Hat</li><li>Supports modern security standards</li><li>Easily deployable in containerized environments</li></ul><h3>Challenges and Considerations</h3><p>While powerful, Keycloak also has some considerations:</p><ul><li>Initial setup and configuration can be complex</li><li>Requires proper security hardening (e.g., CSP, HTTPS, token lifetimes)</li><li>Performance tuning is necessary for large-scale deployments</li></ul><h3>Conclusion</h3><p>Keycloak is a robust and flexible identity and access management solution that simplifies authentication and authorization in modern applications. By centralizing security concerns and supporting industry standards, Keycloak allows developers to focus on building application logic rather than reinventing security mechanisms. For organizations seeking a reliable, scalable, and open-source IAM solution, Keycloak is a strong choice.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c0ae482988b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying P3X Redis UI on Kubernetes with OIDC Authentication and NGINX Ingress]]></title>
            <link>https://medium.com/@kavindasamarawickkrama2001/deploying-p3x-redis-ui-on-kubernetes-with-oidc-authentication-and-nginx-ingress-a072487fc914?source=rss-d82a0226d57e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a072487fc914</guid>
            <dc:creator><![CDATA[Kavinda Samarawickkrama]]></dc:creator>
            <pubDate>Sat, 06 Dec 2025 07:35:49 GMT</pubDate>
            <atom:updated>2025-12-06T07:35:49.463Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*l0VjN23Qf9P5Sb0nF-TFIg.jpeg" /></figure><p>Managing Redis instances becomes far easier when you have a user-friendly interface. <strong>P3X Redis UI</strong> is one of the most popular open-source tools for this, but deploying it securely inside an enterprise Kubernetes environment isn’t straightforward — especially when you need:</p><ul><li>Non-root containers</li><li>Persistent user settings</li><li>OIDC authentication</li><li>NGINX Ingress rewrites</li><li>Working <strong>Socket.IO</strong> connections</li></ul><p>In this article, I’ll walk through how I deployed <strong>P3X Redis UI</strong> into a Kubernetes cluster with full authentication and a custom Ingress configuration to support both HTTP and real-time Socket.IO traffic.</p><h3><strong>1. Preparing the Kubernetes Resources</strong></h3><h4>1.1 Service Account</h4><p>We start by creating a dedicated ServiceAccount so the Deployment does not run under the default account.</p><pre>apiVersion: v1<br>kind: ServiceAccount<br>metadata:<br>  name: p3x</pre><h4>1.2 Service (ClusterIP)</h4><p>P3X Redis UI exposes port <strong>7843</strong>, so we create a ClusterIP service:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: p3x<br>spec:<br>  type: ClusterIP<br>  ports:<br>  - port: 7843<br>    targetPort: 7843<br>    protocol: TCP<br>  selector:<br>    app: p3x</pre><h4>1.3 Persistent Volume Claim</h4><p>P3X stores user settings inside /settings, so we attach a PVC:</p><pre>apiVersion: v1<br>kind: PersistentVolumeClaim<br>metadata:<br>  name: p3x-pvc<br>spec:<br>  accessModes:<br>    - ReadWriteOnce<br>  resources:<br>    requests:<br>      storage: 2Gi</pre><h3>1.4 Deployment Configuration</h3><p>This Deployment follows production-ready security recommendations:</p><ul><li>run as non-root (runAsUser: 1000)</li><li>disable privilege escalation</li><li>read-only root filesystem</li><li>place temp files in /tmp through emptyDir</li></ul><p>It includes health probes and resource limits:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: p3x<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: p3x<br>  template:<br>    metadata:<br>      labels:<br>        app: p3x<br>    spec:<br>      serviceAccountName: p3x<br>      securityContext:<br>        fsGroup: 1000<br>        runAsUser: 1000<br>        runAsGroup: 1000</pre><p>Then the container:</p><pre>containers:<br>- name: p3x<br>  image: patrikx3/p3x-redis-ui:latest<br>  imagePullPolicy: IfNotPresent<br>  securityContext:<br>    allowPrivilegeEscalation: false<br>    readOnlyRootFilesystem: true  <br>    runAsUser: 1000<br>    runAsGroup: 1000<br>  ports:<br>  - containerPort: 7843</pre><p>Volumes:</p><pre>volumeMounts:<br>- name: p3x-data<br>  mountPath: /settings<br>- name: tmp<br>  mountPath: /tmp</pre><p>Health checks:</p><pre>livenessProbe:<br>  httpGet:<br>    path: /api/health<br>    port: 7843</pre><h3>2. Why Two Ingress Objects?</h3><p>This is the most important part.</p><p>P3X Redis UI uses <strong>Socket.IO</strong>, which behaves differently from normal HTTP traffic.<br> If you apply the same rewrite rules to /socket.io, the WebSocket handshake breaks.</p><p>To solve this problem:</p><h4>Ingress 1 → Socket.IO</h4><p>No rewrites, no sub_filter — just pass traffic directly.</p><pre>---<br>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  annotations:<br>  name: p3x-socketio-ingress<br>  labels:<br>    app: p3x<br>spec:<br>  ingressClassName: nginx<br>  rules:<br>  - host: {{ hostname }}<br>    http:<br>      paths:<br>      - backend:<br>          service:<br>            name: p3x<br>            port:<br>              number: 7843<br>        path: /socket.io<br>        pathType: Prefix<br>  tls:<br>  - hosts:<br>    - {{ hostname }}</pre><h3>Ingress 2 → Main UI</h3><p>Here we use:</p><ul><li>rewrite-target</li><li>sub_filter for fixing internal paths</li><li>OIDC authentication (auth-url + auth-signin)</li></ul><pre>---<br>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  annotations:<br>    nginx.ingress.kubernetes.io/auth-response-headers: Authorization<br>    nginx.ingress.kubernetes.io/auth-signin: <br>    nginx.ingress.kubernetes.io/auth-url: <br>    nginx.ingress.kubernetes.io/configuration-snippet: |<br>      sub_filter_types application/javascript text/html;<br>      sub_filter href=&quot;/&quot; href=&quot;/p3x/&quot;;<br>      sub_filter src=&quot;/&quot; src=&quot;/p3x/&quot;;<br>      sub_filter_once off;<br>  name: p3x-http-ingress<br>  labels:<br>    app: p3x<br>spec:<br>  ingressClassName: nginx<br>  rules:<br>  - host: {{ hostname }}<br>    http:<br>      paths:<br>      - backend:<br>          service:<br>            name: p3x<br>            port:<br>              number: 7843<br>        path: /p3x(/|$)(.*)<br>        pathType: Prefix<br>  tls:<br>  - hosts:<br>    - {{ hostname }} </pre><p>The sub_filter ensures UI assets load correctly behind the /p3x path.</p><h3>3. OIDC Authentication Layer</h3><p>The deployment integrates authentication via:</p><ul><li>auth-url</li><li>auth-signin</li><li>auth-response-headers</li></ul><p>These annotations enforce OIDC login before accessing P3X:</p><pre>nginx.ingress.kubernetes.io/auth-url: http://oidc-auth.../validate  <br>nginx.ingress.kubernetes.io/auth-signin: https://{{ hostname }}/ce/authhub/...</pre><h3>Conclusion</h3><p>Deploying P3X Redis UI on Kubernetes is not just a simple container run — it requires thoughtful configuration to support authentication, persistence, security, and real-time connections.</p><p>This setup is production-ready and can be adopted in any enterprise Kubernetes environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a072487fc914" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Valkey 8.0 and Beyond: What the Redis Fork Means for Developers]]></title>
            <link>https://medium.com/@kavindasamarawickkrama2001/valkey-8-0-and-beyond-what-the-redis-fork-means-for-developers-5f7c6b8aa935?source=rss-d82a0226d57e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f7c6b8aa935</guid>
            <dc:creator><![CDATA[Kavinda Samarawickkrama]]></dc:creator>
            <pubDate>Wed, 26 Nov 2025 14:21:29 GMT</pubDate>
            <atom:updated>2025-11-26T14:21:29.570Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pc__gZ7bkUzdcYTCkVv9vA.png" /></figure><p><strong>Redis</strong> has been a cornerstone of modern application architecture. From session caching to real-time analytics pipelines, Redis’s in-memory design has powered high-traffic events and mission-critical systems for companies like Airbnb, Hulu, Niantic, and even OpenAI.</p><p>But 2024 marked a turning point. With Redis shifting its licensing model to a dual-source-available approach, major cloud vendors — including AWS and Google Cloud — decided to fork Redis 7.2.4 and continue developing it under a fully open-source model.<br> That fork became <strong>Valkey</strong>.</p><p>Over the past year, Valkey has evolved rapidly. While it started as a drop-in-compatible Redis fork, it is now growing into a distinct technology with its own roadmap, contributors, and identity. As both ecosystems continue to diverge, companies evaluating in-memory data stores must understand where each project is headed — and what Valkey brings to the table.</p><h3>What Is Valkey?</h3><p>Valkey is an <strong>open-source, in-memory key-value datastore</strong>, originally forked from Redis 7.2.4. Like Redis, Valkey keeps data in RAM for extreme read/write speed, making it ideal for applications that require low-latency performance.</p><p>Launched in March 2024 under the <strong>Linux Foundation</strong>, Valkey has quickly become a community-driven alternative. Its release of <strong>Valkey 8.0 in September 2024</strong> marked the project’s first major departure from Redis’s core codebase.</p><h3>Key Features of Valkey</h3><p>While Valkey remains closely aligned with Redis in many core areas, it’s already introducing its own improvements. Here’s what Valkey currently offers:</p><h4>1. High-Performance In-Memory Data Storage</h4><p>Just like Redis, Valkey keeps all active data in memory — making it incredibly fast for request-heavy, real-time workloads.</p><h4>2. Replication</h4><p>Valkey supports <strong>master–replica replication</strong>, enabling horizontal scaling and fault tolerance.</p><h4>3. Clustering at Scale</h4><p>Valkey clusters support <strong>up to 1000 nodes</strong>, making it suitable for large distributed workloads with automatic failover.</p><h4>4. Rich Data Structures</h4><p>Valkey supports:</p><ul><li>Strings</li><li>Lists</li><li>Sets &amp; Sorted Sets</li><li>Maps / Hashes</li><li>Bitmaps</li><li>Streams</li><li>HyperLogLog</li><li>Geospatial indexes</li></ul><h3>What Is Valkey Used For?</h3><p>Valkey’s performance profile makes it ideal for low-latency, high-throughput systems. Common use cases include:</p><h4>Session Caching</h4><p>Applications can store recently accessed user-specific data for fast retrieval without repeatedly querying primary databases.</p><h4>Message Queuing</h4><p>Valkey supports message ordering and channel-based broadcasting, making it useful for notification systems, job queues, or lightweight pub/sub messaging.</p><h4>Real-Time Updates</h4><p>Ecommerce sites, gaming platforms, or telemetry systems can rely on Valkey to keep state and inventory synced in real time.</p><h3>Valkey Advantages</h3><p>Despite being new, Valkey is not just a clone. It already includes technical improvements that differentiate it from Redis today.</p><h3>1. Enhanced I/O Multithreading</h3><p>Valkey 8.0 introduced advanced multithreading improvements, enabling:</p><ul><li>Better multi-core utilization</li><li>Asynchronous I/O operations</li><li>Over <strong>3× higher throughput</strong> than previous versions</li></ul><p>This pushes Valkey closer to enterprise-grade performance — without enterprise licensing.</p><h4>2. Experimental RDMA Support</h4><p>Valkey offers early support for <strong>Remote Direct Memory Access (RDMA)</strong> — something Redis does not provide natively.</p><p>RDMA enables:</p><ul><li>Ultra-low latency data transfer</li><li>High bandwidth communication</li><li>Direct memory access between servers</li></ul><h3>Limitations and Challenges of Valkey</h3><p>Valkey’s biggest gaps appear when compared to Redis’s extensive, mature ecosystem.</p><h3>1. Missing Advanced Redis Modules</h3><p>Redis has evolved far beyond key-value caching. Modern Redis provides:</p><ul><li>RedisJSON</li><li>RedisTimeSeries</li><li>Redis Query Engine (search, indexing, aggregations)</li><li>Vector Search (for RAG/GenAI applications)</li><li>Probabilistic data structures</li><li>Redis Data Integration (Real-time SOR sync)</li><li>Smart Cache for JDBC apps</li><li>RedisInsight UI + Redis Copilot (AI-powered)</li></ul><h4>2. Lack of Official Operational Support</h4><p>Redis provides enterprise support offerings.Valkey does not.</p><p>According to a Percona survey, <strong>76% of organizations</strong> considering Valkey expect they will need third-party support to operate it in production.</p><h4>3. Client Library Compatibility</h4><p>Most popular client libraries — redis-py, Jedis, node-redis, NRedisStack, Go-Redis — are built for Redis first. Long-term compatibility with Valkey is uncertain.</p><h4>4. Lower Developer Familiarity</h4><p>Redis has more than a decade of trust and community adoption.</p><p>StackOverflow 2024 survey stats:</p><ul><li>22.8% of developers used Redis extensively</li><li>67% admire Redis</li><li>28% want to continue using Redis</li></ul><h3>Two Projects, Two Futures</h3><p>Redis and Valkey share the same origin — but not the same destination.</p><h4>Valkey is ideal if you want:</h4><ul><li>A fully open-source alternative</li><li>High-performance in-memory caching</li><li>Cutting-edge multithreading</li><li>Experimental RDMA support</li><li>A community-led development model</li></ul><h4>Redis is ideal if you want:</h4><ul><li>A full-featured operational database</li><li>JSON, time-series, vector search, and AI workloads</li><li>Rich search and query layers</li><li>Production-grade enterprise support</li><li>A mature ecosystem and tooling</li></ul><h3>Final Thoughts</h3><p>The emergence of Valkey is a win for the open-source world. It gives developers new choices, promotes transparency, and pushes innovation across the in-memory data ecosystem.</p><p>But Redis and Valkey are no longer interchangeable. As both continue to evolve, teams must evaluate not just the present — but the philosophy, roadmap, and long-term direction of each project.</p><p>Valkey has the potential to become the open-source engine for next-gen real-time systems.<br> Redis remains the powerhouse for teams needing advanced workloads beyond caching.</p><p>In the end, the “right” choice depends on your use case, your risk appetite, and the direction you want your infrastructure to grow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f7c6b8aa935" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating from Grafana Promtail to Grafana Alloy — A Complete Guide]]></title>
            <link>https://medium.com/@kavindasamarawickkrama2001/migrating-from-grafana-promtail-to-grafana-alloy-a-complete-guide-f7d1a14b2972?source=rss-d82a0226d57e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7d1a14b2972</guid>
            <dc:creator><![CDATA[Kavinda Samarawickkrama]]></dc:creator>
            <pubDate>Sun, 09 Nov 2025 17:09:10 GMT</pubDate>
            <atom:updated>2025-11-10T06:34:52.856Z</atom:updated>
            <content:encoded><![CDATA[<h3>Migrating from Grafana Promtail to Grafana Alloy — A Complete Guide</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KM50vGT0pKzb3Pb9GGwtrQ.png" /></figure><p>Grafana has introduced <strong>Alloy</strong>, a next-generation telemetry collector designed to unify and simplify observability across metrics, logs, and traces. For teams using <strong>Grafana Promtail</strong> (for logs) or <strong>Prometheus</strong> (for metrics), Alloy offers a modern, extensible, and more maintainable alternative.</p><p>In this article, I’ll walk through how I <strong>migrated from Grafana Promtail to Grafana Alloy</strong>, with a focus on:</p><ul><li>The migration process</li><li>Key configuration changes</li><li>And a quick look at converting Prometheus configs using the Alloy CLI</li></ul><h3>Why Move to Grafana Alloy?</h3><p>Grafana Alloy acts as a <strong>unified collector</strong> for metrics, logs, and traces. It’s designed to replace Promtail, Prometheus Agent, and other specialized collectors, letting you manage everything from one configuration file written in <strong>HCL (HashiCorp Configuration Language)</strong>.</p><h4>Key Benefits</h4><ul><li>Unified telemetry collection</li><li>Simplified config syntax (HCL over YAML)</li><li>Modular design — add or remove integrations easily</li><li>Improved resource management</li><li>Secure, read-only runtime mode</li></ul><p>By consolidating multiple agents into one, Alloy reduces both <strong>operational complexity</strong> and <strong>infrastructure overhead</strong>.Installing Grafana Alloy CLI</p><h3>Install Grafana Alloy CLI</h3><p>Start by installing the <strong>Alloy CLI</strong>, which is used to run, validate, and convert configurations.</p><pre>curl -sSL https://raw.githubusercontent.com/grafana/alloy/main/install.sh | bash</pre><p>Then verify the installation:</p><pre>alloy --version</pre><h3>Convert Prometheus Configuration to Alloy</h3><p>If you’re currently using Prometheus, you can <strong>convert its configuration directly into an Alloy-compatible HCL file</strong> using the alloy convert command.</p><p>This ensures that you take advantage of Alloy’s extended functionality while preserving your existing Prometheus setup.</p><p>Open your terminal and run:</p><pre>alloy convert --source-format=prometheus --output=&lt;OUTPUT_CONFIG_PATH&gt; &lt;INPUT_CONFIG_PATH&gt;</pre><p>Replace:</p><ul><li>&lt;INPUT_CONFIG_PATH&gt; → The full path to your <strong>Prometheus configuration</strong></li><li>&lt;OUTPUT_CONFIG_PATH&gt; → The full path to your <strong>new Alloy configuration</strong></li></ul><h3>Migrate Promtail Configuration to Alloy</h3><p>For log collection, Alloy replaces Promtail seamlessly.<br> During migration, I used the Alloy CLI to migrate my <strong>Promtail configuration</strong> into Alloy’s HCL format.</p><h4>Key change: Positions file</h4><p>Promtail required a manually pre-created positions directory. Alloy, however, <strong>automatically generates this file</strong>, simplifying setup.</p><p>I set the path as:</p><pre>legacy_positions_file = &quot;/data-alloy/loki.source.file.kubernetes_pods/positions.yaml&quot;</pre><p>Alloy creates this automatically, so there’s <strong>no need to create a folder manually</strong> as before.</p><h3>Container Configuration</h3><p>Here’s the <strong>updated container argument section</strong>, adjusted for Alloy:</p><pre>args:<br>  - &quot;run&quot;<br>  - &quot;--server.http.listen-addr=0.0.0.0:3101&quot;<br>  - &quot;/etc/alloy/alloy-config.hcl&quot;</pre><p>This replaces the Promtail entry point and aligns with Alloy’s runtime requirements.</p><h3>Create the Alloy Configuration (HCL)</h3><p>The configuration below defines:</p><ul><li>Kubernetes pod discovery</li><li>Relabeling</li><li>File matching for logs</li><li>Loki pipeline and endpoint configuration</li></ul><pre>discovery.kubernetes &quot;kubernetes_pods&quot; {<br>  role = &quot;pod&quot;<br>}<br><br>local.file_match &quot;kubernetes_pods&quot; {<br>  path_targets = discovery.kubernetes.kubernetes_pods.targets<br>}<br><br>loki.source.file &quot;kubernetes_pods&quot; {<br>  targets               = local.file_match.kubernetes_pods.targets<br>  forward_to            = [loki.process.kubernetes_pods.receiver]<br>  legacy_positions_file = &quot;/data-alloy/loki.source.file.kubernetes_pods/positions.yaml&quot;<br>  tail_from_end         = true<br>}<br><br>loki.process &quot;kubernetes_pods&quot; {<br>  forward_to = [loki.write.default.receiver]<br>  stage.cri { }<br>}<br><br>loki.write &quot;default&quot; {<br>  endpoint {<br>    url = &quot;http://grafana-loki:3100/loki/api/v1/push&quot;<br>  }<br>}</pre><h3>Resource Management and Validation</h3><p>After deploying Alloy, I validated it through the <strong>Grafana dashboard</strong>:</p><ul><li>Logs flowed successfully into Loki</li><li>The new positions file was auto-created</li></ul><h3>Migration Success Criteria</h3><p>You can consider the migration complete when:</p><ul><li>Promtail is fully removed across clusters</li><li>Alloy consistently collects and forwards logs to Loki</li><li>No major data loss or downtime occurs</li><li>Resources remain within configured limits</li></ul><h3>Final Thoughts</h3><p>Migrating from <strong>Grafana Promtail (and Prometheus)</strong> to <strong>Grafana Alloy</strong> is a major step toward a <strong>unified observability architecture</strong>.<br> Alloy’s modular design, simplified configuration, and built-in conversion tools make the process smooth and future-proof.</p><p>By following these steps, you can modernize your log and metric pipelines while maintaining full reliability — and prepare your observability stack for what’s next in the Grafana ecosystem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7d1a14b2972" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Strengthening Kubernetes Security with Immutable Filesystems and Restricted Privileges]]></title>
            <link>https://medium.com/@kavindasamarawickkrama2001/strengthening-kubernetes-security-with-immutable-filesystems-and-restricted-privileges-26d19ac90218?source=rss-d82a0226d57e------2</link>
            <guid isPermaLink="false">https://medium.com/p/26d19ac90218</guid>
            <dc:creator><![CDATA[Kavinda Samarawickkrama]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 16:57:40 GMT</pubDate>
            <atom:updated>2025-09-21T16:57:40.252Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Xw8k1pbPKhP_ZCE8lBFTg.png" /></figure><p>Security in Kubernetes clusters is not just about network policies and RBAC. Azure’s security best practices emphasize the importance of locking down containers at the filesystem and process level. By enforcing immutable filesystems, running workloads as non-root, and disabling privilege escalation, we can drastically reduce the attack surface in AKS (Azure Kubernetes Service) or any Kubernetes environment.</p><p>In this article, we’ll look at three critical security enhancements, why they matter, how they work, and what you need to be mindful of when enabling them.</p><h3>1. Read-Only Root Filesystem</h3><h4>Why it matters</h4><p>A read-only root filesystem prevents malicious binaries from being injected into the container’s runtime. If an attacker gains access, they won’t be able to drop new executables or tamper with system files inside the container. This immutability helps contain compromises and makes forensic analysis easier.</p><h4>How it helps</h4><ul><li>Blocks attackers from modifying /bin, /usr, and other critical paths.</li><li>Ensures container builds remain predictable and consistent across environments.</li><li>Reduces persistence opportunities for malware inside containers.</li></ul><h4>What to watch out for</h4><p>Applications often expect to write logs, temporary files, or cache data at runtime. With a read-only root filesystem, these writes will fail. To fix this:</p><ul><li>Use <strong>emptyDir volumes</strong> to provide writable scratch space.</li><li>Mount writable volumes only where necessary.</li><li>Redirect logs to stdout/stderr for collection by Kubernetes logging solutions.</li></ul><h3>2. Running as a Non-Root User</h3><h4>Why it matters</h4><p>By default, many containers run as root, which is risky. In Kubernetes, root inside the container isn’t just “superuser” inside the pod — it can sometimes translate into host-level root access if misconfigurations exist. That’s a privilege escalation nightmare waiting to happen.</p><h4>How it helps</h4><ul><li>Limits the damage if a container process is compromised.</li><li>Prevents attackers from easily accessing host resources.</li><li>Enforces least-privilege principles at runtime.</li></ul><h4>What to watch out for</h4><p>Running as non-root can break applications that try to write or modify files in system-owned directories. To handle this:</p><ul><li>Use <strong>init containers</strong> to prepare files, populate configuration, or copy dependencies before the main container starts.</li><li>Change ownership of writable paths during the init phase, since you cannot easily chown them at runtime.</li><li>Ensure Kubernetes securityContext explicitly sets a non-root UID/GID.</li></ul><pre>initContainers:<br>      - command:<br>        - sh<br>        - -c<br>        - |<br>          cp -r /usr/share/nginx/html/* /tmp/html/ &amp;&amp; cp -r /etc/nginx/conf.d/* /tmp/conf/ &amp;&amp; cp -r /var/run/* /tmp/run/<br>          ls /tmp/html<br>          chown -R 1000:1000 /tmp/html<br>          chown -R 1000:1000 /tmp/conf<br>          chown -R 1000:1000 /tmp/client_temp<br>          chown -R 1000:1000 /tmp/run<br>        image:  &lt;image&gt;<br>        name: &lt;name&gt;<br>        securityContext:<br>          runAsUser: 0<br>        volumeMounts:<br>        - mountPath: /tmp/run<br>          name: tmp-run-volume<br>        - mountPath: /tmp/client_temp<br>          name: tmp-client-temp-volume<br>        - mountPath: /tmp/conf<br>          name: tmp-conf-volume<br>        - mountPath: /tmp/html<br>          name: tmp-html-volume</pre><h3>3. Disallowing Privilege Escalation</h3><h4>Why it matters</h4><p>Even if a process starts as a non-root user, certain Linux capabilities could allow it to elevate privileges during runtime. If attackers exploit a vulnerability, they could gain root-level access inside the container.</p><h4>How it helps</h4><ul><li>Ensures no process within the container can gain higher privileges than it was started with.</li><li>Eliminates privilege-based attack vectors.</li><li>Aligns with Azure’s container security recommendations for AKS.</li></ul><h4>What to watch out for</h4><ul><li>Verify your workloads don’t rely on setuid or similar privilege-changing mechanisms.</li><li>Explicitly set allowPrivilegeEscalation: false in your pod security context.</li><li>Test your workloads after applying this setting to catch unexpected permission issues.</li></ul><p>By combining these three configurations:</p><ul><li><strong>Immutable containers</strong> with a read-only filesystem</li><li><strong>Restricted processes</strong> running as non-root</li><li><strong>Hardened privilege settings</strong> with escalation disabled</li></ul><pre>securityContext:<br>            readOnlyRootFilesystem: true<br>            allowPrivilegeEscalation: false<br>            runAsUser: 1000<br>            runAsGroup: 1000</pre><h3>Conclusion</h3><p>These measures don’t just align with Azure’s security guidance — they’re universal best practices for protecting containerized applications from privilege abuse and runtime tampering.</p><p>The key is to balance security with functionality. Some workloads may need writable paths or initialization steps, and Kubernetes provides tools like emptyDir volumes and init containers to accommodate these needs safely.</p><p>Adopting these practices across your AKS clusters will significantly reduce your risk exposure while maintaining reliable, secure deployments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26d19ac90218" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>