<?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 Wilgner Lopes on Medium]]></title>
        <description><![CDATA[Stories by Wilgner Lopes on Medium]]></description>
        <link>https://medium.com/@wilgnerlopes?source=rss-15a5a664fa2d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ufj5F8IEp0pIpHgh</url>
            <title>Stories by Wilgner Lopes on Medium</title>
            <link>https://medium.com/@wilgnerlopes?source=rss-15a5a664fa2d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:06:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wilgnerlopes/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[From HTTP Retries to Kafka Redelivery: Building End-to-End Idempotency with FastAPI]]></title>
            <link>https://medium.com/@wilgnerlopes/from-http-retries-to-kafka-redelivery-building-end-to-end-idempotency-with-fastapi-386a3f56522c?source=rss-15a5a664fa2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/386a3f56522c</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Wilgner Lopes]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 23:47:32 GMT</pubDate>
            <atom:updated>2026-07-19T23:47:32.845Z</atom:updated>
            <content:encoded><![CDATA[<p>How idempotency keys, transactional outbox, consumer deduplication, database transactions, retries, and DLQs work together</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pPm06rAOCABsr4gx" /></figure><p>A payment request can be repeated even when the client never intended to submit it twice.</p><p>Consider a simple failure scenario:</p><ol><li>A client sends POST /payments.</li><li>The server successfully processes the request.</li><li>The network connection fails before the response reaches the client.</li><li>The client cannot determine whether the operation succeeded.</li><li>The client retries.</li></ol><p>Without idempotency, this retry may create a second payment.</p><p>But making the HTTP endpoint idempotent solves only half of the problem. After the API accepts the payment, the resulting event may also be delivered more than once by Kafka.</p><p>The system therefore has two independent duplication boundaries:</p><pre>HTTP retry:<br>Client → Payment API<br><br>Kafka redelivery:<br>Kafka → Process Worker</pre><p>Each boundary requires its own persistent identity:</p><pre>Idempotency-Key → protects the HTTP request<br><br>event_id        → protects the business event</pre><p>In this lab, I built both layers using FastAPI, PostgreSQL, Kafka, SQLAlchemy, Alembic, aiokafka, Docker Compose, and uv.</p><p>The objective was not to prevent repetition.</p><p>It was to make repetition safe.</p><h3>The architecture</h3><p>The project contains two applications:</p><ul><li><strong>Payment</strong>, responsible for accepting idempotent payment requests and creating outbox events.</li><li><strong>Process</strong>, responsible for consuming payment events and applying the business effect exactly once from the application’s perspective.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*60fsZrF5ElokIMOp" /></figure><p>The Payment API does not publish directly to Kafka.</p><p>Instead, it stores both the API result and a pending outbox event in the same PostgreSQL transaction. A separate worker later publishes the event to Kafka. On the consumer side, the Process Worker records the event_id and creates the business effect within another atomic database transaction.</p><p>This distinction matters because HTTP idempotency, reliable event publication, and consumer deduplication are related problems, but they are not the same problem.</p><h3>Part 1: making the HTTP endpoint idempotent</h3><p>The client sends an idempotency key in the request header:</p><pre>POST /payments HTTP/1.1<br>Content-Type: application/json<br>Idempotency-Key: demo-request-001<br><br>{<br>  &quot;payment_id&quot;: &quot;payment-001&quot;<br>}</pre><p>The key belongs in the HTTP header because it represents request execution semantics rather than payment domain data.</p><p>The payload describes what the client wants to execute.</p><p>The idempotency key identifies one logical operation across multiple execution attempts.</p><h3>Why an in-memory key is not enough</h3><p>A common first implementation stores previously seen keys in memory this does not provide a meaningful guarantee.</p><p>The data disappears when the process restarts. It is not shared between multiple API replicas, and concurrent requests can still race against each other.</p><p>The key must be persisted in shared storage with a uniqueness constraint.</p><p>Conceptually, the PostgreSQL primary key is not merely a validation rule. It is the concurrency mechanism that decides which request owns the idempotency key.</p><p>A fragile implementation would first check whether the key exists and only then insert it:</p><pre>SELECT ...<br>if not found:<br>    INSERT ...</pre><p>Two concurrent requests can both complete the SELECT before either INSERT happens. The uniqueness constraint must arbitrate that race atomically.</p><pre>CREATE TABLE idempotency_keys (<br>    idempotency_key TEXT PRIMARY KEY,<br>    request_hash TEXT NOT NULL,<br>    response_status INTEGER,<br>    response_body JSONB,<br>    event_id UUID,<br>    created_at TIMESTAMPTZ NOT NULL DEFAULT now()<br>);</pre><h3>The request hash prevents key misuse</h3><p>An idempotency key should identify one logical operation.</p><p>Consider these two requests:</p><pre>Idempotency-Key: checkout-001<br><br>{<br>  &quot;payment_id&quot;: &quot;payment-001&quot;<br>}</pre><pre>Idempotency-Key: checkout-001<br><br>{<br>  &quot;payment_id&quot;: &quot;payment-999&quot;<br>}</pre><p>Silently returning the first response for the second payload would hide a client bug.</p><p>Executing the second payload would violate the meaning of the key.</p><p>The API therefore stores a hash of the original request.</p><p>The resulting behavior is:</p><pre>| Idempotency key | Request payload   | Result                 |<br>| --------------- | ----------------- | ---------------------- |<br>| New key         | Any valid payload | Process request        |<br>| Existing key    | Same payload      | Return stored response |<br>| Existing key    | Different payload | Return `409 Conflict`  |</pre><p>The hash must be deterministic.</p><p>Hashing arbitrary JSON bytes is unsafe because semantically equivalent objects may have different property ordering:</p><pre>{&quot;payment_id&quot;:&quot;payment-001&quot;,&quot;currency&quot;:&quot;BRL&quot;}</pre><pre>{&quot;currency&quot;:&quot;BRL&quot;,&quot;payment_id&quot;:&quot;payment-001&quot;}</pre><p>A canonical representation should be generated before calculating the hash:</p><pre>import hashlib<br>import json<br>from typing import Any<br><br><br>def calculate_request_hash(payload: dict[str, Any]) -&gt; str:<br>    canonical_payload = json.dumps(<br>        payload,<br>        sort_keys=True,<br>        separators=(&quot;,&quot;, &quot;:&quot;),<br>        ensure_ascii=False,<br>    )<br><br>    return hashlib.sha256(<br>        canonical_payload.encode(&quot;utf-8&quot;)<br>    ).hexdigest()</pre><h3>Returning the original response</h3><p>When the API receives the same key with the same payload, it should not execute the operation again.</p><p>Most importantly, the retry does not create another outbox event.</p><p>This gives the client stable behavior even when it cannot tell whether the original HTTP response was successfully delivered.</p><h3>Part 2: the dual-write problem</h3><p>An idempotent HTTP endpoint is still not sufficient.</p><p>The API needs to persist its state and publish an event to Kafka.</p><p>A naive flow would be:</p><ol><li>Save payment state in PostgreSQL</li><li>Publish event to Kafka</li></ol><p>The process may crash after step 1 and before step 2.</p><p>The payment exists, but no event is published.</p><p>Reversing the order does not solve the problem:</p><ol><li>Publish event to Kafka</li><li>Save payment state in PostgreSQL</li></ol><p>Now the process may crash after publishing the event but before persisting the state.</p><p>This is the dual-write problem: one logical operation is being written independently to two systems that do not share a transaction.</p><h3>Solving publication consistency with the transactional outbox</h3><p>Instead of publishing directly to Kafka, the API writes an outbox record in the same PostgreSQL transaction as the idempotency result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7WfVFRLeBhPfcgiN" /></figure><p>Either both records are committed or neither is.</p><p>The database transaction now contains everything required to eventually publish the event:</p><ul><li>the accepted HTTP result;</li><li>the stable event_id;</li><li>the event payload;</li><li>the pending publication state.</li></ul><p>A separate outbox worker reads pending events and publishes them to Kafka.</p><p>This removes the dangerous consistency window between persisting the API result and creating the event that must be published.</p><p>The repository’s current payment flow stores the idempotency record, response, and pending outbox event in one transaction. The outbox worker then publishes pending records and marks them as published.</p><h3>The outbox does not magically create exactly-once delivery</h3><p>There is still an important crash window:</p><ol><li>Outbox worker publishes the event</li><li>Kafka acknowledges it</li><li>Worker crashes</li><li>Database row is not marked as published</li><li>Worker restarts</li><li>Event is published again</li></ol><p>The outbox guarantees eventual publication.</p><p>It does not guarantee that Kafka will observe only one publication attempt.</p><p>This is why the consumer must still be idempotent.</p><p>A strong system does not depend on every upstream component delivering something only once.</p><p>It assumes duplicates can happen and makes them harmless.</p><h3>Part 3: Kafka offsets are not business event identifiers</h3><p>Kafka stores messages inside partitions.</p><p>Each message receives an offset representing its position in that partition:</p><pre>Partition 0:<br>offset 40<br>offset 41<br>offset 42</pre><p>The offset answers:</p><blockquote><em>Where is this record located in this partition?</em></blockquote><p>It does not answer:</p><blockquote><em>Which business event does this record represent?</em></blockquote><p>The same logical event may be published again and receive a different offset.</p><p>Offsets are also scoped to partitions. Offset 42 in partition 0 is unrelated to offset 42 in partition 1.</p><p>The consumer therefore cannot use the Kafka offset as the persistent identity of a payment event.</p><p>That role belongs to event_id.</p><p>This distinction is fundamental.</p><p>Kafka controls delivery progress through offsets.</p><p>The application controls business deduplication through event identities.</p><h3>Why Kafka may redeliver a message</h3><p>Consider this sequence:</p><pre>1. Consumer reads a payment event<br>2. Consumer processes the payment<br>3. Consumer crashes before committing the offset<br>4. Kafka still considers that offset uncommitted for the consumer group.<br>5. Kafka delivers the message again</pre><p>The redelivery is intentional.</p><p>Committing the offset before processing would create a worse failure mode:</p><pre>1. Consumer commits the offset<br>2. Consumer starts processing<br>3. Consumer crashes<br>4. Kafka considers the message complete<br>5. The business effect is lost</pre><p>A safer order is:</p><pre>1. Read message<br>2. Commit database transaction<br>3. Commit Kafka offset</pre><p>This protects against message loss, but it permits redelivery.</p><p>The consumer must therefore be able to process the same event_id more than once without duplicating the effect.</p><h3>Part 4: consumer-side deduplication</h3><p>The Process Worker stores consumed business event identifiers in a table and for each Kafka message, the worker attempts to claim the event</p><pre>CREATE TABLE processed_events (<br>    event_id UUID PRIMARY KEY,<br>    processed_at TIMESTAMPTZ NOT NULL DEFAULT now()<br>);</pre><pre>INSERT INTO processed_events (event_id)<br>VALUES (:event_id)<br>ON CONFLICT DO NOTHING;</pre><p>The result defines the next action:</p><pre>Row inserted:<br>    this is a new event<br>    execute the business operation<br>No row inserted:<br>    this event was already processed<br>    perform an intentional no-op</pre><p>Using ON CONFLICT DO NOTHING is safer than performing a separate existence check because the uniqueness constraint resolves concurrent attempts atomically.</p><h3>Deduplication and the business effect must share a transaction</h3><p>Simply writing to processed_events is not enough.</p><p>Consider this broken sequence:</p><pre>1. Insert event_id into processed_events<br>2. Commit<br>3. Apply payment business effect<br>4. Crash</pre><p>When Kafka redelivers the event, the consumer finds event_id in processed_events and skips it.</p><p>But the business effect never happened.</p><p>The inverse ordering is also unsafe:</p><pre>1. Apply payment business effect<br>2. Crash<br>3. Insert into processed_events never happens<br>4. Kafka redelivers the event<br>5. Business effect runs again</pre><p>The deduplication record and the business effect must be committed atomically. Only after the PostgreSQL transaction succeeds should the worker commit the Kafka offset.</p><p>The lab follows this model: new events create both processed_events and processed_payments records in the same transaction, while duplicate events become intentional no-ops. The corresponding Kafka offset is committed afterward.</p><h3>Processing a duplicate is still successful processing</h3><p>A duplicate event should not be treated as an unexpected exception.</p><p>It is a valid outcome of an at-least-once delivery system.</p><p>The worker has consciously determined that no additional business action is necessary:</p><pre>New event:<br>    apply effect<br>    commit database<br>    commit offset<br><br>Duplicate event:<br>    apply no-op<br>    commit database<br>    commit offset</pre><p>In both cases, the consumer has successfully handled the message.</p><p>This is important because failing to commit the duplicate’s offset would cause Kafka to keep delivering a message the application has already decided to ignore.</p><h3>Invalid messages, retries, and the DLQ</h3><p>Not every failure is temporary.</p><p>A consumer may receive:</p><ul><li>malformed JSON;</li><li>an event with missing fields;</li><li>an unsupported schema version;</li><li>a payload that violates domain constraints;</li><li>a poison message that always produces the same failure.</li></ul><p>If the worker never commits the offset, the message can be delivered indefinitely.</p><p>That can block useful work or create an endless failure loop.</p><p>A DLQ prevents infinite redelivery, but it is not a complete operational solution by itself.</p><p>A production system still needs:</p><ul><li>alerting;</li><li>visibility into failed events;</li><li>replay tooling;</li><li>rules for deciding when replay is safe;</li><li>retention policies;</li><li>event version information.</li></ul><p>The lab uses bounded in-process retries with backoff before routing the event to the DLQ. It does not implement durable delayed retries or dedicated retry topics.</p><p>Once the failed event is successfully published to the DLQ, the worker can commit the original offset. If publishing to the DLQ also fails, the original offset must remain uncommitted.</p><h3>What guarantees does this architecture provide?</h3><p>The lab provides several concrete guarantees:</p><h3>At the HTTP boundary</h3><ul><li>An idempotency key is atomically claimed through PostgreSQL uniqueness.</li><li>The same key and canonical payload return the stored response.</li><li>The same key with a different payload returns 409 Conflict.</li><li>A retry does not create another outbox event.</li></ul><h3>Between PostgreSQL and Kafka</h3><ul><li>The API response and outbox event are persisted atomically.</li><li>Once the database transaction commits, the event publication intent is durably stored in the outbox and can be retried by the worker.</li><li>The outbox worker can retry unpublished records until they are successfully published or moved into an operational failure state.</li></ul><h3>At the consumer boundary</h3><ul><li>The consumer deduplicates through a unique event_id.</li><li>Deduplication and the database-backed business effect share one transaction.</li><li>The Kafka offset is committed only after the transaction commits.</li><li>Repeatedly failing messages are retried and eventually routed to a DLQ.</li></ul><p>The project intentionally does not claim exactly-once message delivery. The outbox worker can publish an event again after a specific crash window, and the consumer makes that redelivery safe.</p><h3>Final takeaway</h3><p>Idempotency does not mean preventing a request or message from being repeated.</p><p>Retries are unavoidable in distributed systems.</p><p>Networks fail. Processes crash. Consumers rebalance. Acknowledgements are lost. Events are redelivered.</p><p>A reliable architecture assumes repetition will happen.</p><p>The goal is not “never repeat.”</p><p>The goal is:</p><blockquote><em>Repeat safely, predictably, and without duplicating business side effects.</em></blockquote><p>github repo: <a href="https://github.com/wilgnerl/idempotency-lab">https://github.com/wilgnerl/idempotency-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=386a3f56522c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building AI Agents in Production: Why Distributed Systems Matter More Than Prompt Engineering]]></title>
            <link>https://medium.com/@wilgnerlopes/building-ai-agents-in-production-why-distributed-systems-matter-more-than-prompt-engineering-ca62863da6fb?source=rss-15a5a664fa2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca62863da6fb</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Wilgner Lopes]]></dc:creator>
            <pubDate>Sun, 07 Jun 2026 01:04:02 GMT</pubDate>
            <atom:updated>2026-06-07T01:04:02.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztvXsqwMVuHeEugWlgpY6A.png" /></figure><p>When I started building AI agents, I thought prompt engineering would be the hardest part. Well, I was wrong…</p><p>Getting an agent to work took less than two weeks.</p><p>Getting it to scale, remain deterministic, maintain context, and serve multiple users reliably was a completely different challenge.</p><p>After building planner-synthesizer architectures connected to structured and unstructured data sources, I learned something unexpected:</p><p>Building AI agents in production looks much more like building distributed systems than writing prompts.</p><p>Here are the biggest lessons I learned.</p><h3>Lesson 1: Getting an Agent to Work Is Easy</h3><p>Frameworks like ADK and LangGraph make it surprisingly easy to build a working prototype. The first version of our system was operational in roughly two weeks.</p><p>At that point, it could:</p><ul><li>Query databases</li><li>Search knowledge bases</li><li>Use RAG</li><li>Execute Text-to-SQL workflows</li><li>Combine multiple data sources</li></ul><p>The demo worked.</p><p>Production did not. Our first versions could take up to two minutes to answer simple questions.</p><p>The agent frequently selected the wrong tools, lost context between conversations, and struggled when multiple requests arrived simultaneously.</p><p>That was the moment I realized building an agent was not the hard part.<br>Operating it was.</p><h3>Lesson 2: Architecture Matters More Than Most People Think</h3><p>One of the biggest surprises was how much architecture influences quality.</p><p>Initially I used a ReAct architecture. Over time we migrated to a Planner-Synthesizer pattern with specialized sub-agents.</p><p>This allowed us to:</p><ul><li>Use stronger models for planning</li><li>Use cheaper and faster models for synthesis</li><li>Reduce latency</li><li>Improve determinism</li><li>Improve debugging</li></ul><p>One thing that surprised me was how much model specialization mattered.</p><p>Using a powerful model for every step increased latency without improving results.</p><p>We achieved better performance by using stronger models in the planning stage and faster models in synthesis and formatting tasks.</p><p>The architecture decision had more impact than any individual prompt optimization.</p><h3>Lesson 3: Model Parameters Are Product Features</h3><p>Before this project, I underestimated the impact of parameters such as:</p><ul><li>Temperature</li><li>Top-P</li><li>Thinking Budget</li></ul><p>Small changes could dramatically affect:</p><ul><li>Response quality</li><li>Consistency</li><li>Latency</li><li>Cost</li></ul><p>I stopped thinking of these as configuration values and started treating them as part of the product itself.</p><h3>Lesson 4: Observability Saved</h3><p>My first debugging strategy was logs. It quickly became impossible to understand:</p><ul><li>Which tool was called</li><li>Why it was called</li><li>Where latency was introduced</li><li>Why the agent failed</li></ul><p>Everything changed after introducing:</p><ul><li>OpenTelemetry</li><li>Arize Phoenix</li><li>Distributed Tracing</li><li>Evaluation Frameworks</li></ul><p>Before tracing, debugging felt like guesswork.</p><p>The agent would return a bad answer and we had no idea why.</p><ul><li>Was the planner wrong?</li><li>Was the retrieval step poor?</li><li>Was the wrong tool selected?</li><li>Was the model hallucinating?</li></ul><p>Once we introduced OpenTelemetry and Arize Phoenix, we could finally see the entire execution path.</p><p>Tracing became the most valuable tool in our stack.</p><h3>Lesson 5: Context Windows Lie</h3><p>One of our biggest mistakes was assuming that a one-million-token context window solved context management.</p><p>In practice, model quality degraded much earlier.</p><p>Around 100k tokens, we started noticing:</p><ul><li>Lost context</li><li>Reduced reasoning quality</li><li>Incorrect tool selection</li></ul><p>Large context windows are useful but they are not infinite memory.</p><h3>Lesson 6: AI Agents Need Reliability Engineering</h3><p>Many tutorials assume a happy path. Production systems don’t.</p><p>I had to implement:</p><ul><li>Retries</li><li>Timeouts</li><li>Fallback models</li><li>Fallback flows</li><li>Queueing systems</li><li>Bulkhead patterns</li><li>Session persistence</li><li>Memory management</li></ul><p>The agent failed.</p><p>The models failed.</p><p>The databases failed.</p><p>The network failed.</p><p>The system had to continue working anyway.</p><h3>Lesson 7: Structured Knowledge Beats Bigger Context, The Text-to-SQL Problem Nobody Talks About</h3><p>One interesting challenge involved Text-to-SQL.</p><p>Our database contained millions of rows and many tables.</p><p>Sending schema information directly to the model was inefficient.</p><p>Instead, we built a scheduled process that:</p><ul><li>Scanned tables weekly</li><li>Extracted unique values from string columns</li><li>Generated metadata files</li><li>Used Jaccard similarity to identify relevant tables and columns and match with the question</li></ul><p>This dramatically improved table selection and query accuracy. Sometimes better retrieval beats bigger prompts.</p><h3>Final Thoughts</h3><p>The biggest lesson wasn’t about prompts.</p><p>It was realizing that successful AI systems are still built on the same foundations that have always mattered:</p><ul><li>Architecture.</li><li>Observability.</li><li>Reliability.</li><li>Engineering discipline.</li></ul><p>The models are new.</p><p>The engineering challenges are not.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca62863da6fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud Security Best Practices: Protecting Your AWS Infrastructure]]></title>
            <link>https://medium.com/@wilgnerlopes/cloud-security-best-practices-protecting-your-aws-infrastructure-e3503de976a7?source=rss-15a5a664fa2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3503de976a7</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Wilgner Lopes]]></dc:creator>
            <pubDate>Wed, 18 Dec 2024 23:40:49 GMT</pubDate>
            <atom:updated>2024-12-18T23:40:49.390Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dz518STz2GfhcSVQBtX_pQ.png" /></figure><p>Cloud computing has become essential for businesses today, offering scalability, flexibility, and cost savings. AWS (Amazon Web Services) stands out as a leading provider, enabling organizations to innovate and adapt quickly to changing demands. However, the increased reliance on AWS services also introduces security risks. Protecting your AWS infrastructure is crucial to maintaining trust and ensuring smooth operations. So, how can you ensure your AWS environment remains secure while taking full advantage of its benefits?</p><p>This article outlines practical strategies and tools to strengthen AWS cloud security and safeguard your infrastructure against evolving cyber threats.</p><h3>Understanding the AWS Security Landscape</h3><p>AWS security focuses on protecting data, applications, and services hosted on AWS from unauthorized access and breaches. It operates under the <strong>shared responsibility model</strong>, which divides responsibilities between AWS and the customer.</p><h4>The Shared Responsibility Model</h4><ul><li><strong>AWS’s Role:</strong> Securing the physical infrastructure, including hardware, software, and networks.</li><li><strong>Customer’s Role:</strong> Protecting data, managing user access, and properly configuring AWS resources.</li></ul><p>Understanding this model is key to avoiding gaps in security. AWS provides robust infrastructure and tools, but customers must implement these effectively to maintain a secure environment.</p><h3>Best Practices for AWS Security</h3><h4><strong>Implement Strong Identity and Access Management (IAM)</strong></h4><p>AWS Identity and Access Management (IAM) is fundamental to controlling access:</p><ul><li>Require <strong>multi-factor authentication (MFA) </strong>for all AWS accounts, adding an extra layer of protection.</li><li>Follow the <strong>principle of least privilege </strong>by granting users only the permissions they need. This minimizes exposure if an account is compromised.</li><li>Use <strong>IAM roles</strong> instead of long-term access keys for applications and services. Roles provide temporary credentials, reducing the risk of misuse.</li><li>Regularly audit and refine IAM policies with <strong>IAM Access Analyzer</strong> to identify and eliminate overly permissive policies.</li></ul><h4><strong>Encrypt Data at Rest and in Transit</strong></h4><p>Encryption is a cornerstone of AWS security:</p><ul><li>Enable <strong>S3 bucket encryption</strong> by default and use <strong>AWS Key Management Service (KMS)</strong> to manage encryption keys securely.</li><li>Apply <strong>TLS (Transport Layer Security) </strong>for encrypting data in transit, ensuring secure connections.</li><li>Use <strong>AWS Secrets Manager </strong>or <strong>AWS Systems Manager Parameter Store</strong> to store sensitive information like database credentials and API keys.</li><li>For highly sensitive data, consider <strong>client-side encryption</strong> before uploading it to AWS services.</li></ul><h4><strong>Continuously Monitor and Log Activities</strong></h4><p>Monitoring tools are critical for identifying threats:</p><ul><li>Enable <strong>AWS CloudTrail</strong> to log all API activity, creating an audit trail for forensic investigations.</li><li>Use <strong>Amazon CloudWatch</strong> to monitor resource metrics, set alarms for anomalies, and analyze logs with <strong>CloudWatch Logs Insights.</strong></li><li>Integrate findings from <strong>AWS Security Hub</strong>, which aggregates data from services like <strong>Amazon GuardDuty, Amazon Macie, and AWS Inspector.</strong></li><li>Deploy <strong>Amazon Detective</strong> to visualize and analyze security data using machine learning.</li></ul><h4>Automate Security with AWS Services</h4><p>Automation minimizes errors and increases efficiency:</p><ul><li>Use <strong>AWS CloudFormation</strong> or <strong>AWS CDK</strong> to define and enforce secure configurations for resources.</li><li>Detect threats with <strong>Amazon GuardDuty</strong>, which monitors traffic and identifies potential compromises.</li><li>Conduct regular vulnerability scans using <strong>Amazon Inspector</strong>, which checks EC2 instances and container images.</li><li>Employ <strong>AWS Config</strong> to continuously monitor resource compliance and automatically remediate non-compliant configurations.</li></ul><h4>Apply Regular Updates and Patches</h4><p>Outdated software can be exploited by attackers:</p><ul><li>Use <strong>AWS Systems Manager Patch Manager</strong> to automate patching across EC2 instances and other services.</li><li>Schedule maintenance windows for critical updates to minimize business disruption.</li><li>Track patch compliance with <strong>AWS Systems Manager Compliance Dashboard</strong> to ensure no resource is left behind.</li></ul><h4>Conduct Regular Security Assessments</h4><p>Periodic evaluations help identify vulnerabilities:</p><ul><li>Use <strong>AWS Trusted Advisor</strong> to receive tailored recommendations for optimizing configurations, improving security, and reducing costs.</li><li>Explore third-party tools available in the AWS Marketplace for comprehensive assessments.</li></ul><h3>Real-World Applications of AWS Security Practices</h3><h4>Case 1: Preventing S3 Misconfigurations</h4><p>A retail company experienced a data breach due to a misconfigured S3 bucket. By enabling <strong>S3 Block Public Access</strong>, enforcing encryption policies, and using <strong>AWS Confi</strong>g to detect misconfigurations, such incidents can be avoided.</p><h4>Case 2: Enhancing Security with GuardDuty</h4><p>A financial institution implemented <strong>Amazon GuardDuty </strong>to monitor and detect unusual account activity. By automating responses with <strong>AWS Lambda</strong> and blocking malicious IPs through <strong>AWS WAF</strong>, the company significantly reduced its incident response time.</p><h4>Case 3: Automating HIPAA Compliance with AWS Config</h4><p>A healthcare organization utilized <strong>AWS Config</strong> to ensure HIPAA compliance. Custom rules and automated remediations streamlined their operations, enabling them to focus on patient care while maintaining security standards.</p><h3>Conclusion</h3><p>Securing your AWS infrastructure is an ongoing process that requires a proactive approach. By implementing these best practices, leveraging AWS’s extensive security tools, and educating your team, you can build a robust security posture that adapts to evolving threats.</p><p>Begin by auditing your current security measures and identifying areas for improvement. With the right tools and strategies, you can ensure your AWS environment remains secure and reliable. What steps will you take to strengthen your AWS security today? Share your thoughts and insights in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3503de976a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to Kubernetes RBAC: Securing Your Cluster]]></title>
            <link>https://medium.com/@wilgnerlopes/an-introduction-to-kubernetes-rbac-securing-your-cluster-9510775c0805?source=rss-15a5a664fa2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9510775c0805</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Wilgner Lopes]]></dc:creator>
            <pubDate>Wed, 11 Dec 2024 02:14:49 GMT</pubDate>
            <atom:updated>2024-12-11T02:14:49.649Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MHur1XFHrDga2Xlf3fkNRw.png" /></figure><h3>Role-Based Access Control (RBAC) in Kubernetes</h3><p>As Kubernetes adoption continues to grow, so does the importance of securing clusters to protect workloads and sensitive data. Role-Based Access Control (RBAC) is a key feature in Kubernetes that provides fine-grained control over user and service permissions, helping you enforce the principle of least privilege.</p><p>In this article, we’ll explore what Kubernetes RBAC is, why it’s essential for security, and how to get started with configuring it in your cluster. Additionally, we’ll dive deeper into advanced use cases and provide actionable tips to optimize your RBAC implementation.</p><h3>What is Kubernetes RBAC?</h3><p>RBAC is a security mechanism that regulates access to resources in a Kubernetes cluster based on defined roles and permissions. Using RBAC, administrators can specify what actions a user or service account can perform and on which resources.</p><h4>Key Components of RBAC</h4><ul><li><strong>Role:</strong> A set of permissions (rules) that define access to resources within a namespace.</li><li><strong>ClusterRole: </strong>Similar to a Role, but applies to all namespaces in the cluster.</li><li><strong>RoleBinding:</strong> Grants a Role to a user or service account within a specific namespace.</li><li><strong>ClusterRoleBinding:</strong> Grants a ClusterRole to a user or service account across the entire cluster.</li></ul><p>By leveraging these components, RBAC allows administrators to enforce strict access controls tailored to organizational policies.</p><h3>Why is RBAC Important?</h3><p>RBAC is vital for several reasons:</p><ol><li><strong>Security:</strong> It minimizes the risk of unauthorized actions by limiting access to only what is necessary for each user or service account. Misconfigured permissions are one of the leading causes of security breaches in Kubernetes environments, making RBAC a critical line of defense.</li><li><strong>Compliance: </strong>Many regulatory frameworks require strict access controls, and RBAC provides a way to meet these requirements. For example, compliance with GDPR or HIPAA often necessitates granular access restrictions.</li><li><strong>Auditability:</strong> RBAC simplifies tracking and auditing permissions, making it easier to identify potential misconfigurations or malicious activity. This capability is invaluable for maintaining accountability and transparency.</li><li><strong>Scalability:</strong> As your cluster and team grow, RBAC enables you to manage permissions consistently and efficiently, reducing administrative overhead.</li></ol><h4>Real-World Example</h4><p>Consider a financial services company managing sensitive customer data in Kubernetes. By using RBAC, the company can ensure that only authorized personnel can access sensitive resources, significantly reducing the risk of data breaches.</p><h3>How Does RBAC Work in Kubernetes?</h3><p>RBAC operates by matching requests to permissions specified in Roles or ClusterRoles. When a user or service account attempts an action, Kubernetes evaluates whether a corresponding RoleBinding or ClusterRoleBinding grants the necessary permissions. If no match is found, the action is denied.</p><h4>Example Workflow</h4><ol><li>A user requests to list pods in a namespace.</li><li>Kubernetes checks if there’s a RoleBinding that grants the “list” action on the “pods” resource.</li><li>If a matching RoleBinding exists, the action is allowed; otherwise, it is denied.</li></ol><h4>Advanced Features</h4><p>RBAC also supports:</p><ul><li><strong>Custom Resources: </strong>Extend RBAC to control access to custom resources defined in your cluster.</li><li><strong>Dynamic Admission Controllers:</strong> Use RBAC in conjunction with admission controllers for additional layers of security.</li></ul><h4>Setting Up RBAC: A Step-by-Step Guide</h4><h4>1. Create a Role</h4><p>A Role defines specific permissions within a namespace. Below is an example of a Role that grants read access to pods:</p><pre>apiVersion: rbac.authorization.k8s.io/v1<br>kind: Role<br>metadata:<br>  namespace: default<br>  name: pod-reader<br>rules:<br>- apiGroups: [&quot;&quot;]<br>  resources: [&quot;pods&quot;]<br>  verbs: [&quot;get&quot;, &quot;list&quot;, &quot;watch&quot;]</pre><h4>2. Bind the Role to a User or Service Account</h4><pre>apiVersion: rbac.authorization.k8s.io/v1<br>kind: RoleBinding<br>metadata:<br>  name: pod-reader-binding<br>  namespace: default<br>subjects:<br>- kind: User<br>  name: jane.doe<br>  apiGroup: &quot;&quot;<br>roleRef:<br>  kind: Role<br>  name: pod-reader<br>  apiGroup: rbac.authorization.k8s.io</pre><h4>3. Verify Permissions</h4><p>After creating the Role and RoleBinding, you can verify the permissions using the `kubectl auth can-i` command:</p><pre>kubectl auth can-i list pods --namespace=default</pre><p>This command checks if the user has the specified permission and returns “yes” or “no.”</p><h4>4. Advanced Bindings</h4><p>For multi-namespace access, consider using ClusterRoles and ClusterRoleBindings. These allow for permissions that span multiple namespaces or the entire cluster, reducing redundancy in configurations.</p><h3>Best Practices for RBAC</h3><p>To maximize the effectiveness of RBAC, follow these best practices:</p><ol><li><strong>Enforce the Principle of Least Privilege:</strong> Grant only the permissions that are strictly necessary for users and service accounts.</li><li><strong>Use Namespaces Effectively: </strong>Segment your cluster into namespaces and apply RBAC rules at the namespace level to limit the scope of access.</li><li><strong>Regularly Audit Permissions: </strong>Periodically review Roles and RoleBindings to ensure they align with current requirements. Automation tools like kube-bench or kubesec can assist in these audits.</li><li><strong>Leverage Default Roles:</strong> Kubernetes provides built-in ClusterRoles like `view`, `edit`, and `admin`, which can simplify permission management.</li><li><strong>Avoid Wildcard Permissions:</strong> Be explicit in defining verbs and resources to minimize accidental over-permissioning.</li><li><strong>Combine RBAC with Network Policies:</strong> Enhance security by combining RBAC with Kubernetes network policies to control traffic between pods and external entities.</li></ol><h4>Additional Tips</h4><ul><li>Use tools like Open Policy Agent (OPA) or Gatekeeper to enforce RBAC policies programmatically.</li><li>Maintain detailed documentation of roles and permissions to facilitate onboarding and troubleshooting.</li></ul><h3>Conclusion</h3><p>Kubernetes RBAC is a powerful tool for securing your cluster and managing access control. By understanding its components and following best practices, you can effectively safeguard your workloads and data while maintaining compliance and scalability. RBAC not only enhances security but also streamlines operations in complex Kubernetes environments.</p><p>Whether you’re managing a small development cluster or a large-scale production system, implementing and optimizing RBAC is a critical step in ensuring the integrity and reliability of your Kubernetes deployment.</p><p>Ready to take the next step? Start implementing RBAC in your cluster today and experience the benefits of improved security and control.</p><p><em>What strategies have you used to manage Kubernetes access control? Share your thoughts in the comments below!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9510775c0805" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a CI/CD Pipeline with GitLab CI: A Hands-On Guide]]></title>
            <link>https://medium.com/@wilgnerlopes/building-a-ci-cd-pipeline-with-gitlab-ci-a-hands-on-guide-2e491adaae1c?source=rss-15a5a664fa2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e491adaae1c</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[gitlab-ci]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[continuos-integration]]></category>
            <dc:creator><![CDATA[Wilgner Lopes]]></dc:creator>
            <pubDate>Sat, 07 Dec 2024 19:19:26 GMT</pubDate>
            <atom:updated>2024-12-07T19:19:26.568Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1nqs_-G_Q8MixxWo7Kvxw.png" /></figure><p>In today’s fast-paced software world, delivering quality code quickly and reliably isn’t just a nice-to-have — it’s a must. Continuous Integration and Continuous Delivery (CI/CD) pipelines help you achieve this by automating the grunt work so you can focus on innovation. GitLab CI offers a fully integrated platform that seamlessly brings together code hosting, testing, and deployment. The result? Shorter feedback loops, fewer production headaches, and a more efficient engineering workflow.</p><p>This hands-on guide walks you through setting up a CI/CD pipeline with GitLab CI, complete with a practical example to help you hit the ground running.</p><h3>Why CI/CD Matters</h3><p>As projects scale and teams grow, manual testing and ad-hoc releases become bottlenecks. CI/CD enforces quality checks at every commit, ensuring issues surface sooner rather than later. By catching bugs early and automating deploys, your team can focus on building features that truly matter — without constantly worrying about breakage or last-minute firefights.</p><p>GitLab CI integrates directly with your repository, providing a single source of truth. No more juggling between third-party tools or piecing together disparate systems. Everything — from code reviews to deployment logs — is in one place, boosting collaboration and cutting down on operational friction.</p><h3>Getting Started with GitLab</h3><p>Before diving into pipelines, ensure your project lives in GitLab:</p><ol><li>Log into your GitLab account.</li><li>Click <strong>New Project</strong>.</li><li>Set up your repository and push your code.</li></ol><p>Once done, you’re ready to define your pipeline.</p><h3>Crafting Your .gitlab-ci.yml</h3><p>At the heart of GitLab CI lies the .gitlab-ci.yml file, located in your repository’s root. Here you’ll define stages, jobs, and their respective tasks. Let’s start with a simple three-stage pipeline—<strong>build</strong>, <strong>test</strong>, and <strong>deploy</strong>:</p><pre>stages:<br>  - build<br>  - test<br>  - deploy<br><br>build_job:<br>  stage: build<br>  script:<br>    - echo &quot;Building the project...&quot;<br>    - npm install<br>    - npm run build<br><br>test_job:<br>  stage: test<br>  script:<br>    - echo &quot;Running tests...&quot;<br>    - npm test<br><br>deploy_job:<br>  stage: deploy<br>  script:<br>    - echo &quot;Deploying application...&quot;<br>    - npm run deploy<br>  only:<br>    - main</pre><p>This configuration ensures every commit triggers a chain reaction: your code is built, validated, and — if it’s on the main branch — automatically deployed.</p><h3>Setting Up a GitLab Runner</h3><p>GitLab Runners execute the jobs defined in your pipeline. To set one up:</p><ol><li>Install the runner following the <a href="https://docs.gitlab.com/runner/">official documentation</a>.</li><li>Register the runner:</li><li>Associate it with your repository or group.</li></ol><pre>gitlab-runner register</pre><p>With this in place, your pipeline jobs will kick off the moment you push your changes.</p><h3>Observing the Pipeline in Action</h3><p>Once your .gitlab-ci.yml file is committed:</p><ol><li>Navigate to <strong>CI/CD &gt; Pipelines</strong> in GitLab.</li><li>Watch as each stage — build, test, and deploy — runs sequentially.</li><li>Review the logs and artifacts for insights or troubleshooting.</li></ol><h3>A Practical Example: React Applications</h3><p>Imagine building a React app. Your pipeline might:</p><ul><li><strong>Build:</strong> Install dependencies and compile for production.</li><li><strong>Test:</strong> Run unit and integration tests using Jest.</li><li><strong>Deploy:</strong> Ship your finalized build to production or staging environments (like Netlify or AWS).</li></ul><pre>stages:<br>  - build<br>  - test<br>  - deploy<br><br>build_job:<br>  stage: build<br>  script:<br>    - npm ci<br>    - npm run build<br><br>unit_tests:<br>  stage: test<br>  script:<br>    - npm test<br><br>deploy_to_production:<br>  stage: deploy<br>  script:<br>    - echo &quot;Deploying to production...&quot;<br>    - npm run deploy<br>  only:<br>    - main</pre><p>This setup ensures your React application is continually vetted and safely deployed — no manual handoffs needed.</p><h3>Final Thoughts</h3><p>Implementing a CI/CD pipeline with GitLab CI revolutionizes how you deliver software. Instead of scrambling at release time, you’ll benefit from a steady, reliable flow of changes landing in production. As your project matures, you can fine-tune your pipeline — adding parallel testing, environment-specific configurations, or containerization — to further optimize your workflow.</p><p>In an industry where speed, quality, and resilience define success, investing in automated pipelines is a game-changer. Embrace GitLab CI and watch as your team reclaims its energy, devoting more time to crafting features that engage users and less time fighting fires. Your code — and your audience — will thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e491adaae1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Linux Basics: Your First Step in the DevOps Journey]]></title>
            <link>https://medium.com/@wilgnerlopes/mastering-linux-basics-your-first-step-in-the-devops-journey-2a69ce41e1ef?source=rss-15a5a664fa2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a69ce41e1ef</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux-commands]]></category>
            <category><![CDATA[system-administration]]></category>
            <dc:creator><![CDATA[Wilgner Lopes]]></dc:creator>
            <pubDate>Sat, 23 Nov 2024 23:49:50 GMT</pubDate>
            <atom:updated>2024-11-23T23:49:50.264Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WFmKHEPE5tpnP7EkMViVDQ.png" /></figure><p>Linux is the backbone of modern computing. From powering enterprise servers to hosting your personal website, it is an essential skill for anyone stepping into the DevOps world. This article breaks down Linux basics into digestible concepts and practical examples to help you get started. By the end of this post, you’ll understand key Linux commands, editors, package managers, and services — everything you need to kickstart your journey.</p><h3>Understanding Shell Types</h3><p>A shell is your gateway to interacting with Linux. It interprets your commands and communicates with the operating system. Here are the most common shell types:</p><ul><li><strong>sh</strong> (Bourne Shell): The original shell in Unix systems.</li><li><strong>csh</strong> (C Shell): Inspired by C programming language syntax.</li><li><strong>zsh</strong> (Z Shell): Packed with features like improved scripting capabilities and customizations.</li><li><strong>bash</strong> (Bourne Again Shell): The default shell in most Linux distributions; user-friendly and powerful.</li></ul><p>To check your current shell, use:</p><pre>echo $SHELL</pre><h3>Why Learn About Shells?</h3><p>Understanding the shell you’re using allows you to write efficient scripts and leverage its unique features. For example, zsh’s autocompletion capabilities can save you hours.</p><h3>Essential Linux Commands</h3><p>Linux commands are your toolkit for managing files, navigating directories, and controlling the system. Here’s a breakdown of foundational commands:</p><h3>File and Directory Management</h3><ul><li><strong>echo</strong>: Prints text to the screen. Example:</li></ul><pre>echo &quot;Hello, Linux!&quot;</pre><ul><li><strong>ls</strong>: Lists files and directories.</li><li><strong>cd</strong>: Changes the current directory.</li><li><strong>pwd</strong>: Displays the current directory path.</li><li><strong>mkdir</strong>: Creates directories. Use -p to create nested directories.</li></ul><pre>mkdir -p project/src</pre><ul><li><strong>rm</strong>: Deletes files or directories. Use -r for directories.</li></ul><pre>rm -r old_project</pre><ul><li><strong>cp</strong>: Copies files or directories. Use -r for directories.</li></ul><pre>cp -r src/ backup/src/</pre><ul><li><strong>touch</strong>: Creates an empty file.</li></ul><pre>touch empty_file.txt</pre><ul><li><strong>mv</strong>: Moves or renames files.</li></ul><pre>mv old_name.txt new_name.txt</pre><h3>User and System Information</h3><ul><li><strong>whoami</strong>: Displays the current user.</li><li><strong>id</strong>: Provides detailed user information.</li><li><strong>ssh username@ip</strong>: Accesses another system via SSH.</li><li><strong>curl</strong>: Fetches data from URLs. Example:</li></ul><pre>curl -O https://example.com/file.txt</pre><h3>Why These Commands Matter ?</h3><p>These are your daily drivers for interacting with Linux. Mastering them improves productivity and allows you to manage your environment efficiently.</p><h3>VI Editor: Your Text Editing Ally</h3><p>The VI editor is a powerful tool available by default in most Linux systems. It’s lightweight and versatile — perfect for editing configuration files.</p><h3>Modes in VI</h3><ul><li><strong>Command Mode</strong>: Default mode for navigation and commands.</li><li><strong>Insert Mode</strong>: For editing text; activate with i.</li></ul><h3>Key Commands</h3><ul><li>Delete: x</li><li>Copy: yy</li><li>Paste: p</li><li>Save: :w</li><li>Quit: :q</li><li>Save and Quit: :wq</li><li>Undo: u</li><li>Redo: Ctrl + r</li><li>Find: /pattern (navigate occurrences with n).</li></ul><h3>Example</h3><p>To delete the first three lines in a file:</p><pre>d3d</pre><h3>Why VI Matters ?</h3><p>Knowing VI is invaluable for editing files on servers where GUI tools aren’t available. It’s fast, reliable, and universally supported.</p><h3>Managing Packages</h3><p>Linux package managers simplify software installation, updates, and removal. Here’s what you need to know:</p><h3>For CentOS</h3><ul><li><strong>RPM (Red Hat Package Manager)</strong>:</li><li>Install: rpm -i package_name</li><li>Uninstall: rpm -e package_name</li><li>Query: rpm -q package_name</li><li><strong>Yum (Yellowdog Updater Modified)</strong>: Built on RPM for dependency management.</li><li>Install: yum install package_name</li><li>Remove: yum remove package_name</li><li>List packages: yum list</li></ul><h3>Why Learn Package Managers?</h3><p>Package managers automate repetitive tasks, making it easy to maintain your system. Understanding them helps you install and manage tools efficiently.</p><h3>Working with Services</h3><p>Services are programs running in the background, like web servers or databases. Managing them is crucial for system administration.</p><h3>Commands for Service Management</h3><ul><li>Start: systemctl start service_name</li><li>Stop: systemctl stop service_name</li><li>Check Status: systemctl status service_name</li><li>Enable on Startup: systemctl enable service_name</li><li>Disable on Startup: systemctl disable service_name</li></ul><h3>Creating a Custom Service</h3><p>Define your own service in /etc/systemd/system/my_app.service:</p><pre>[Unit]<br>Description=My Application<br><br>[Service]<br>ExecStart=/usr/bin/python3 /path/to/my_app.py<br>Restart=always<br><br>[Install]<br>WantedBy=multi-user.target</pre><p>Reload systemd and start your service:</p><pre>systemctl daemon-reload<br>systemctl start my_app</pre><h3>Why Services Matter ?</h3><p>Services are the heart of server functionality. Knowing how to manage them ensures your applications run reliably.</p><h3>Conclusion</h3><p>Linux is an indispensable skill for any DevOps engineer. By mastering the basics — shells, commands, editors, package managers, and services — you lay a strong foundation for advanced topics like scripting, automation, and system architecture. Remember, practice is key. Fire up your terminal and start experimenting today!</p><p>Are you ready to take the next step in your DevOps journey? Share your thoughts and experiences in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a69ce41e1ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Service Mesh Lab: Setting Up Istio with Kiali, Prometheus, and Grafana on a Local…]]></title>
            <link>https://medium.com/@wilgnerlopes/building-a-service-mesh-lab-setting-up-istio-with-kiali-prometheus-and-grafana-on-a-local-f58ed394869f?source=rss-15a5a664fa2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f58ed394869f</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Wilgner Lopes]]></dc:creator>
            <pubDate>Sat, 02 Nov 2024 23:28:01 GMT</pubDate>
            <atom:updated>2024-11-02T23:35:46.259Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Service Mesh Lab: Setting Up Istio with Kiali, Prometheus, and Grafana on a Local Kubernetes Cluster</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ke9hPayvspvEl-gneVxluA.png" /></figure><p>Microservices architecture has become increasingly popular, and managing the complex network of services can be challenging. Istio is a powerful service mesh that simplifies traffic management, observability, and security within Kubernetes clusters. In this article, we’ll walk through setting up a hands-on lab for Istio on a local environment using Kind and Docker, and explore key features with tools like Kiali, Prometheus, and Grafana.</p><p><strong>Prerequisites and Tool Installation</strong></p><p>To set up this lab environment, you’ll need a few essential tools:</p><ul><li><strong>kubectl</strong>: CLI tool for Kubernetes</li><li><strong>istioctl</strong>: CLI tool to install and manage Istio</li><li><strong>Docker Desktop</strong>: Ensures Kubernetes can run locally</li><li><strong>Kind</strong>: To create a local Kubernetes cluster within Docker</li></ul><p>After ensuring you have these installed, you’re ready to create your cluster.</p><h3>Step 1: Creating a Local Kubernetes Cluster with Kind</h3><p>Let’s begin by setting up a single-node Kubernetes cluster with Kind. Here’s the configuration we used:</p><pre>kind: Cluster<br>apiVersion: kind.x-k8s.io/v1alpha4<br>nodes:<br>  - role: control-plane</pre><p>Save this as kind-config.yaml and create the cluster:</p><pre>kind create cluster --name istio-lab --config kind-config.yaml</pre><p>This creates a local Kubernetes cluster named istio-lab, which we’ll use to install Istio and experiment with its features.</p><h3>Step 2: Installing Istio</h3><p>With the cluster ready, let’s install Istio using its demo profile, which comes pre-configured for experimentation:</p><pre>istioctl install --set profile=demo -y</pre><p>This installs key Istio components:</p><ul><li><strong>Istiod</strong>: Istio’s central control plane</li><li><strong>Ingress Gateway</strong> and <strong>Egress Gateway</strong>: Manage incoming and outgoing traffic</li></ul><p>To inject the Istio sidecar proxy automatically into our services, we enabled sidecar injection in the default namespace:</p><pre>kubectl label namespace default istio-injection=enabled</pre><h3>Step 3: Deploying the Bookinfo Application</h3><p>The Bookinfo application is a sample microservices app provided by Istio. It simulates a retail product page with several components and is perfect for exploring Istio’s traffic management features.</p><ol><li><strong>Deploy the Bookinfo app</strong>:</li></ol><pre>kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/bookinfo/platform/kube/bookinfo.yamlExpose Bookinfo through Istio’s Ingress Gateway:</pre><p>2. <strong>Expose Bookinfo through Istio’s Ingress Gateway</strong>:</p><pre>kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/bookinfo/networking/bookinfo-gateway.yaml</pre><p>3. <strong>Access Bookinfo with Port-Forwarding</strong>:</p><p>Since we’re running a local setup, we used port-forwarding to access Bookinfo via Istio’s Ingress Gateway:</p><pre>kubectl port-forward svc/istio-ingressgateway -n istio-system 8080:80</pre><p>Now, the Bookinfo application is accessible at <a href="http://localhost:8080/productpage.">http://localhost:8080/productpage.</a></p><h3>Step 4: Installing Kiali, Grafana, and Prometheus for Observability</h3><p>To monitor and visualize Istio’s traffic flow and metrics, we set up three tools: Kiali, Prometheus, and Grafana.</p><ul><li><strong>Install Kiali</strong>:</li></ul><pre>kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addons/kiali.yaml</pre><ul><li><strong>Install Grafana</strong>:</li></ul><pre>kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addons/grafana.yaml</pre><ul><li><strong>Install Prometheus</strong>:</li></ul><pre>kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addons/prometheus.yaml</pre><ol><li><strong>Access Kiali and Grafana using Port-Forwarding</strong>:</li></ol><ul><li><strong>Kiali</strong>: kubectl port-forward svc/kiali -n istio-system 20001:20001</li><li><strong>Grafana</strong>: kubectl port-forward svc/grafana -n istio-system 3000:3000</li></ul><p>Kiali is available at <a href="http://localhost:20001,">http://localhost:20001,</a> and Grafana at <a href="http://localhost:3000.">http://localhost:3000.</a></p><h3>Step 5: Exploring Istio’s Capabilities in Kiali</h3><p>With Kiali running, we could visualize the connections between services and observe traffic in real time. Key features we explored in Kiali included:</p><ul><li><strong>Traffic Topology</strong>:</li></ul><p>The <strong>Graph</strong> section in Kiali displays a real-time topology of service connections. We observed how traffic flows between the productpage, details, reviews, and ratings services in the Bookinfo app.</p><ul><li><strong>Live Traffic Monitoring</strong>:</li></ul><p>We monitored request rates and error rates, identifying potential bottlenecks and observing metrics such as latency and throughput between services.</p><ul><li><strong>Metrics and Logs</strong>:</li></ul><p>The <strong>Metrics</strong> tab provides detailed charts for each service, showing response times and error rates, allowing for in-depth performance monitoring.</p><ul><li><strong>Advanced Traffic Management with Istio</strong>:</li></ul><p>Using Istio, we experimented with traffic routing, including:</p><ul><li><strong>Canary Releases</strong>: Gradually route a small percentage of traffic to a new service version.</li><li><strong>A/B Testing</strong>: Route requests based on headers or other attributes.</li><li><strong>Mirroring</strong>: Duplicate traffic to a test service for testing in real time.</li></ul><p>These features enabled us to understand how Istio provides fine-grained control over traffic flow and can improve service resilience.</p><h3>Step 6: Cleaning Up the Lab</h3><p>After completing our exploration, we cleaned up the environment with these steps:</p><ul><li><strong>Delete Addons</strong>:</li></ul><pre>kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addons/kiali.yaml<br>kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addons/grafana.yaml<br>kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addons/prometheus.yaml</pre><ul><li><strong>Uninstall Istio</strong>:</li></ul><pre>istioctl uninstall --purge</pre><ul><li><strong>Delete the Kind Cluster</strong>:</li></ul><pre>kind delete cluster --name istio-lab</pre><h3>Conclusion</h3><p>This lab provided a comprehensive introduction to Istio and its powerful traffic management capabilities. By setting up Kiali, Grafana, and Prometheus, we gained insights into how Istio enhances observability, enabling fine-grained control over traffic flow and service resilience. This setup offers a great foundation for exploring more advanced service mesh scenarios, including security, fault injection, and rate limiting.</p><p>If you enjoyed this article, please like, share, and leave your feedback! I’d love to hear your thoughts and learn about other labs you’d be interested in seeing covered. Happy experimenting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f58ed394869f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>