<?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 Evgeniy Savchenko on Medium]]></title>
        <description><![CDATA[Stories by Evgeniy Savchenko on Medium]]></description>
        <link>https://medium.com/@evgeniy-s?source=rss-df15b8daed93------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kEKJjjKaFpbuBE8DkiApFQ.jpeg</url>
            <title>Stories by Evgeniy Savchenko on Medium</title>
            <link>https://medium.com/@evgeniy-s?source=rss-df15b8daed93------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 17:16:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@evgeniy-s/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[Kindergarten mail digest with DeepSeek and Telegram]]></title>
            <link>https://evgeniy-s.medium.com/kindergarten-mail-digest-with-deepseek-and-telegram-6a57cb3d3633?source=rss-df15b8daed93------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a57cb3d3633</guid>
            <category><![CDATA[deepseek]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[telegram]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Evgeniy Savchenko]]></dc:creator>
            <pubDate>Thu, 29 Oct 2026 00:00:59 GMT</pubDate>
            <atom:updated>2026-10-30T03:33:49.418Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>My two-year-old daughter attends a kindergarten in Argentina. There is a rule that all communication between staff and parents happens via email only. They send everything there: important and unimportant news, schedule updates, holiday greetings, payment reminders and so on. So it’s a mix of noise and things that I wouldn’t want to miss.</p><p>I don’t speak Spanish, so I have to translate every email. And here is the problem. They tend to send emails with little text (or even without it) but add images with text on them. The built-in Gmail translator does not help with this.</p><p>A typical example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*G2RtpMI4FhZwKdO8.png" /><figcaption>A typical email: almost all of the text is in the picture</figcaption></figure><p>So, I decided to build an app that processes these emails for me, classifies them and sends a short summary in Russian to a Telegram group where my wife and I can comfortably read them.</p><p><strong>The code is on GitHub</strong>: <a href="https://github.com/DeV1L/kindergarten-email-checker">DeV1L/kindergarten-email-checker</a>.</p><h3>The general idea</h3><ul><li><strong>No access to my personal mailbox:</strong> Something that reads my whole inbox with an LLM is not what I want to run.</li><li><strong>Simple architecture:</strong> One container, no overhead. It should fit in my Always Free k3s cluster from the <a href="https://evgeniy.tech/2026/10/20/oracle-cloud-k3s.html">previous post</a>.</li><li><strong>One email → one Telegram message:</strong> A short summary in Russian, with urgency and category labels.</li><li><strong>Process images and PDFs:</strong> Most of the content lives there, so the model has to see them.</li><li><strong>Minimize costs:</strong> Don’t send too much to the LLM, and use a cheap one.</li></ul><h3>Implementation</h3><p>A high-level view:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DLHpuNl3RS3qDagPa0QYnQ.png" /><figcaption>A high-level diagram</figcaption></figure><ol><li>A forwarding filter in the personal Gmail forwards the emails from the kindergarten addresses to a dedicated mailbox.</li><li>Every 10 minutes the app connects to the dedicated mailbox over IMAP with an <a href="https://support.google.com/mail/answer/185833">app password</a>, processes the new emails one by one and logs out.</li><li>For each email, the LLM writes a summary, the app posts it to the Telegram group and moves the email to the Processed label.</li></ol><p>Gmail labels are the only state: INBOX is the queue; Processed, Ignored and Failed record the outcome. No database is needed.</p><h4>Processing flow</h4><p>Every 10 minutes the app checks the mailbox. It opens a new IMAP connection, creates the state labels if they are missing, and asks for the unseen emails in INBOX. It fetches them one by one, without marking them as seen, so one email with its attachments is in memory at a time. Each email goes through six stages.</p><h4>1. Allowlist</h4><p>The app reads the From header and compares it with the allowlist. Gmail forwarding keeps this header untouched, so the forwarded copy still shows the kindergarten address. If the sender is on the list, the email moves on to the next stage. If not, the app moves it to Ignored.</p><h4>2. Extraction</h4><p>The model gets text and images. So the app converts every part of the email to text or to an image:</p><ul><li><strong>The body.</strong> The app takes the text/plain part of the body. When the email has only an HTML part, it converts the HTML to text. Long bodies are cut at 40,000 characters.</li><li><strong>PDFs.</strong> If the pages have a text layer, more than 200 characters per page on average, the app extracts the text. If not, it is probably a scan, and the app renders each page to a PNG image.</li><li><strong>Photos.</strong> JPEG, PNG and GIF attachments go to the model encoded in base64. Images under 20 KB (logos, signatures, etc.) are skipped.</li></ul><p>Attachments over 10 MB and files of other types do not go to the model.</p><h4>3. Prompt</h4><p>The app assembles the request in the Anthropic Messages API format:</p><ul><li>The system prompt.</li><li>One user message with a text block: the metadata (sender, subject, dates, etc.), the body text, the text of each PDF.</li><li>The images, in the same user message, each as a base64 image block.</li></ul><h4>4. Model call</h4><p>The app sends the request to the DeepSeek Anthropic-compatible API. It has no JSON mode and no structured output, but it supports tools, and a tool has a JSON schema.</p><p>So, instead of a text answer, the model calls one tool, report_summary, with the summary as the arguments of that call. The input schema of the tool is generated from a Pydantic model. The app validates the tool input against that model.</p><p>If the input is invalid or the model did not call the tool, the app sends the error back as a tool result and asks again. If the second answer is malformed too, the app posts the original text.</p><h4>5. Post</h4><p>The app builds one Telegram message from the fields and sends it with the Bot API:</p><ul><li>A header line: urgency, category, deadline and event date.</li><li>The title in bold.</li><li>The summary.</li><li>“What to do”, when the model found an action.</li><li>The attachment names, when there are any.</li><li>A footer: the subject, the sender and the sent date of the email.</li></ul><p>A Telegram message holds at most 4096 characters. A summary never gets close. The fallback post with the original text can, so the app cuts the text to fit.</p><h4>6. Move</h4><p>The app moves the email to Processed with the IMAP MOVE command. From this moment the email counts as done.</p><h4>Post examples</h4><pre>🔴 High · 🔄 Изменение расписания · 📅 Событие: пн, 12 окт<br>Понедельник 12.10 — выходной: День культурного разнообразия<br><br>В понедельник 12 октября детский сад не работает: государственный праздник —<br>Día del Respeto a la Diversidad Cultural (День уважения к культурному разнообразию).<br>Занятия возобновятся во вторник 13 октября. От родителей ничего не требуется.<br>📎 Вложения: Screenshot_20261009_114802_ChatGPT (1).jpg<br><br>Тема: DÍA DEL RESPETO A LA DIVERSIDAD CULTURAL · От: saladedosceleste2026@gmail.com<br>Отправлено: сб, 10 окт 2026 11:00</pre><p>The first line shows what kind of email it was: urgency, category, deadline, event date. Then the title and the summary itself: what, when, what to do or bring. When there is something to do, it gets its own line. The attachments are listed by name but not uploaded.</p><p>A couple of real examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*wSQzPdNmdvnOBd6I.png" /><figcaption>The email: Monday is a holiday</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/0*t2ngX5cR2I-6Px_Y.png" /><figcaption>The post in Telegram</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/0*r3eIdwLQGDSbk9af.png" /><figcaption>The email: the lending library project</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/0*3qwA0f8tpwRhGzEB.png" /><figcaption>The post in Telegram</figcaption></figure><h3>Gotchas</h3><h4>Gmail labels as the database</h4><p>There is no database and the app has nothing on disk. An email is in exactly one label, and the label says what happened to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5xEt0eKpoFml3SP3GhMkBg.png" /><figcaption>Each email is in exactly one label</figcaption></figure><p>As a bonus, the Gmail web UI is the admin interface. The Failed label shows what went wrong. An email moved back to INBOX gets processed again at the next check.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/0*MR26Y-QbccNjtGSg.png" /><figcaption>Moving an email back to INBOX processes it again</figcaption></figure><h4>DeepSeek quirks</h4><p>DeepSeek serves the Anthropic Messages API format at https://api.deepseek.com/anthropic. The whole call is one request:</p><pre>response = client.messages.create(<br>    model=settings.llm_model,<br>    max_tokens=settings.llm_max_tokens,<br>    system=SYSTEM_PROMPT.replace(&quot;{TOOL_NAME}&quot;, tool_name),<br>    messages=messages,<br>    tools=[tool_definition(settings)],<br>    # DeepSeek rejects a forced tool_choice with thinking on. prompt.md asks for the call.<br>    tool_choice={&quot;type&quot;: &quot;auto&quot;},<br>    thinking={&quot;type&quot;: &quot;enabled&quot;, &quot;budget_tokens&quot;: 8000},  # DeepSeek ignores the budget<br>    output_config={&quot;effort&quot;: settings.llm_effort},<br>)</pre><p>DeepSeek looks like a cheap alternative to the Anthropic API, but it is not an exact copy. Two quirks took a while to figure out.</p><p><strong>1. Thinking and a forced tool call do not work together.</strong> Thinking must be turned on: the emails have dates like “el viernes” that must be resolved from the sent date, and urgency needs a judgement. At the same time the answer must be structured data, so the summary comes back as a call of the report_summary tool, whose JSON schema is generated from a Pydantic model. The Messages API has a way to force a specific tool: tool_choice={&quot;type&quot;: &quot;tool&quot;, &quot;name&quot;: &quot;report_summary&quot;}. DeepSeek rejects it when thinking is on:</p><pre>HTTP 400: {&#39;error&#39;: {&#39;message&#39;: &#39;Thinking mode does not support this tool_choice&#39;, &#39;type&#39;: &#39;invalid_request_error&#39;}}</pre><p>The workaround is tool_choice set to auto, plus a system prompt that tells the model to call the tool exactly once.</p><p><strong>2. Invalid JSON looks like an empty call.</strong> Occasionally DeepSeek writes tool arguments that are not valid JSON and doesn’t report an error. It returns the tool call with the input {}. Pydantic rejects that, and the app sends the error back as a tool_result block with the full previous response and thinking blocks included. The second attempt has been fine every time so far.</p><pre>WARNING kindergarten_email_checker.summarize: uid=11 attempt 1: {&quot;problem&quot;: &quot;invalid report_summary input&quot;, &quot;input&quot;: {}, &quot;errors&quot;: [{&quot;type&quot;: &quot;missing&quot;, &quot;loc&quot;: [&quot;title_ru&quot;], &quot;msg&quot;: &quot;Field required&quot;}, {&quot;type&quot;: &quot;missing&quot;, &quot;loc&quot;: [&quot;summary_ru&quot;], &quot;msg&quot;: &quot;Field required&quot;}, {&quot;type&quot;: &quot;missing&quot;, &quot;loc&quot;: [&quot;urgency&quot;], &quot;msg&quot;: &quot;Field required&quot;}, {&quot;type&quot;: &quot;missing&quot;, &quot;loc&quot;: [&quot;category&quot;], &quot;msg&quot;: &quot;Field required&quot;}]}</pre><h4>“null” is not null</h4><p>The schema has four optional fields: the action, the deadline, the event date and the event time. The model sometimes writes the string &quot;null&quot; instead of a JSON null. As a fix, a validator handles it: the strings &quot;&quot;, &quot;null&quot; and &quot;none&quot; count as no value.</p><h4>Urgency is about time, not about the topic</h4><p>The first prompt version said: high for anything urgent, cancelled, closed, or about health or safety. The model did exactly that. Every health notice became red, including &quot;if your child has symptoms, keep them at home&quot;. Those were false alarms.</p><p>Now the prompt asks one question: how soon must the parent do something?</p><ul><li>high: act within two days, or attendance changes within two days.</li><li>medium: act later, or an event with the child later.</li><li>low: nothing is required. General rules and conditional instructions, such as &quot;if your child has symptoms, keep them at home&quot;, are low.</li></ul><p>The topic went to a separate field, the category: payment, event, closure, health, and so on. Category says what the email is about, urgency says how soon. So a health notice can be health and low at the same time. The category is only a label in the first line of the post.</p><h4>PDFs as images</h4><p>The Anthropic API takes a PDF as a document block, and the model reads it. DeepSeek’s endpoint does not support documents, only images. So the app renders the pages at 110 dpi and sends them as images.</p><h4>Dates and the timezone</h4><p>The prompt gives the model the sent date, the weekday and today’s date, all in the Buenos Aires timezone. The emails say “el lunes” or “el viernes”, not a date, and the model can only resolve that from the day the email was sent.</p><h4>The bot token in the logs</h4><p>The Anthropic SDK and the app itself use httpx2, and at the INFO level it logs the URL of every request. Telegram URLs contain the bot token. A log formatter replaces the token in every line, tracebacks included. The path reads /bot&lt;token&gt;/.</p><h3>Real-world usage</h3><p>The app has been running for three weeks on the free k3s cluster from the <a href="https://evgeniy.tech/2026/10/20/oracle-cloud-k3s.html">previous post</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*nkqoMPVkFUwJgNt7.png" /><figcaption>The deployment on the k3s cluster</figcaption></figure><p>It needs about 60 MiB of memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*ANwb0JT09Lwa3TB8.png" /><figcaption>Memory usage of the pod</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yc7hmEZjAjIEMJxr.png" /><figcaption>The logs of the app</figcaption></figure><p><strong>Some numbers:</strong></p><ul><li>Weeks online: 3</li><li>Emails processed: 15</li><li>DeepSeek: 56 requests, 215k tokens and 0.03 <strong>USD</strong> spent.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/0*ucRMBHCcXPANTXLp.png" /><figcaption>DeepSeek usage in October</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/0*F5_I-kcJ3ppnXIoS.png" /><figcaption>DeepSeek cost, requests and tokens by day</figcaption></figure><h3>Next plans</h3><p>By now, I have about 100 emails from the kindergarten. I’m going to build a golden dataset, run different models against it and measure them: accuracy, cost per email, speed, etc. It will be interesting to compare expensive frontier models with native structured output against cheap Chinese models like DeepSeek.</p><p>That will probably be the next post. Stay tuned.</p><p><em>Originally published at </em><a href="https://evgeniy.tech/2026/10/29/kindergarten-mail-digest.html"><em>https://evgeniy.tech</em></a><em> on October 29, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a57cb3d3633" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A free Kubernetes cluster on Oracle Cloud with k3s and Pulumi]]></title>
            <link>https://evgeniy-s.medium.com/a-free-kubernetes-cluster-on-oracle-cloud-with-k3s-and-pulumi-281bf76dfd1d?source=rss-df15b8daed93------2</link>
            <guid isPermaLink="false">https://medium.com/p/281bf76dfd1d</guid>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[pulumi]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[k3]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Evgeniy Savchenko]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 00:00:04 GMT</pubDate>
            <atom:updated>2026-10-20T19:30:07.776Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Oracle Cloud has an Always Free tier. The best part of it is two always free super-tiny VM.Standard.E2.1.Micro instances. Each has one CPU (actually, <a href="https://blogs.oracle.com/cloud-infrastructure/vcpu-and-ocpu-pricing-information">OCPU</a>) and 1 GB of RAM.</p><p>But what can you do with two 1 GB machines?</p><p>Of course, turn them into a Kubernetes cluster! 😎</p><p>I wrote a Pulumi project that spins up a two-node k3s cluster on Oracle Cloud, with all the cloud resources it needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tOQAnBZOETJH_FiD.png" /></figure><h3>Architecture</h3><p>The repository is a Pulumi program in Python. It creates:</p><ul><li>A virtual cloud network (VCN) with a public subnet, an internet gateway and a security list.</li><li>Two instances with Ubuntu 24.04 Minimal: the server node k3s-server and the agent node k3s-agent-1. k3s installs itself at the first boot.</li><li>A network load balancer with the one reserved public IP (only one is available for free). It forwards port 6443 to the server node, and ports 80 and 443 to both nodes.</li><li>An ephemeral public IP on each node, for SSH and outbound traffic.</li><li>An OCI Vault with two secrets: the k3s join token and the kubeconfig.</li><li>Traefik with Let’s Encrypt certificates for Ingress.</li></ul><p>Everything is inside the Always Free limits. The bill is zero.</p><p>The code is on GitHub: <a href="https://github.com/DeV1L/oracle-cloud-k3s">DeV1L/oracle-cloud-k3s</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qtTJoQHpVvK3z9ZT.png" /></figure><p>Traffic from the internet reaches the reserved public IP on the load balancer. The load balancer sends HTTP and HTTPS to both nodes, where Traefik takes over. Traffic from kubectl goes to port 6443 and reaches the server node only.</p><p>If a node is rebuilt (replaced), the IP and the DNS name stay the same. Each node gets its own ephemeral public IP for outbound traffic and SSH.</p><h3>The Pulumi program</h3><p>The program has one stack, default. All account-specific values are set in <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/pulumi/Pulumi.default.yaml">Pulumi.default.yaml</a>: the region, the availability domain, etc. The other values have defaults.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XT8to5isMUTfl-_R.png" /></figure><p>The entry point is <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/pulumi/__main__.py">__main__.py</a>. It reads the configuration, creates a random join token and then four components:</p><pre>network = NetworkComponent(&quot;network&quot;, config)<br>vault = VaultComponent(&quot;vault&quot;, config, join_token=join_token.result)<br>load_balancer = LoadBalancerComponent(&quot;lb&quot;, config, subnet_id=network.subnet_id)<br>cluster = K3sClusterComponent(&quot;cluster&quot;, config, subnet_id=network.subnet_id, join_token=join_token.result, public_ip=load_balancer.ip_address)</pre><p>Each component is a pulumi.ComponentResource in <a href="https://github.com/DeV1L/oracle-cloud-k3s/tree/main/pulumi/components">its own module</a>. It owns one area of the infrastructure: Network, Vault, Load Balancer, Cluster. The child resources get parent=self, so pulumi preview shows them as a tree under their component. The components connect only through outputs. The network gives the subnet ID, the load balancer gives the reserved IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/0*EqVM97L9SjoRJ0Xy.png" /></figure><h4>A component example</h4><p>The <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/pulumi/components/load_balancer.py">load balancer component</a> is a good example. It creates the entry point of the cluster. This is the shortened version:</p><pre>class LoadBalancerComponent(pulumi.ComponentResource):<br>    &quot;&quot;&quot;Reserved public IP, network load balancer, and a listener for each port.&quot;&quot;&quot;<br><br>    def __init__(self, name, config, subnet_id, opts=None):<br>        super().__init__(&quot;oracle-cloud-k3s:loadbalancer:LoadBalancerComponent&quot;, name, None, opts)<br>        self._name = name<br>        child = pulumi.ResourceOptions(parent=self)<br><br>        self.public_ip = oci.core.PublicIp(<br>            f&quot;{name}-ip&quot;,<br>            compartment_id=config.compartment_ocid,<br>            lifetime=&quot;RESERVED&quot;,<br>            opts=pulumi.ResourceOptions(parent=self, ignore_changes=[&quot;privateIpId&quot;]),<br>        )<br><br>        self.nlb = oci.networkloadbalancer.NetworkLoadBalancer(<br>            f&quot;{name}-nlb&quot;,<br>            compartment_id=config.compartment_ocid,<br>            subnet_id=subnet_id,<br>            is_private=False,<br>            reserved_ips=[oci.networkloadbalancer.NetworkLoadBalancerReservedIpArgs(id=self.public_ip.id)],<br>            opts=child,<br>        )<br><br>        node_ips = [config.server_private_ip, config.agent_private_ip]<br>        self._forward(&quot;api&quot;, config.API_PORT, [config.server_private_ip])<br>        self._forward(&quot;http&quot;, 80, node_ips)<br>        self._forward(&quot;https&quot;, 443, node_ips)<br><br>        self.ip_address = self.public_ip.ip_address<br>        self.register_outputs({&quot;public_ip&quot;: self.ip_address})<br>        pulumi.export(&quot;public_ip&quot;, self.ip_address)<br><br>    def _forward(self, name, port, backend_ips):<br>        &quot;&quot;&quot;Forward TCP `port` to the same port on the backends.&quot;&quot;&quot;<br>        child = pulumi.ResourceOptions(parent=self)<br>        backend_set = oci.networkloadbalancer.BackendSet(<br>            f&quot;{self._name}-{name}&quot;,<br>            network_load_balancer_id=self.nlb.id,<br>            name=name,<br>            policy=&quot;FIVE_TUPLE&quot;,<br>            health_checker=oci.networkloadbalancer.BackendSetHealthCheckerArgs(protocol=&quot;TCP&quot;, port=port),<br>            opts=child,<br>        )<br>        for ip in backend_ips:<br>            oci.networkloadbalancer.Backend(<br>                f&quot;{self._name}-{name}-{ip}&quot;,<br>                network_load_balancer_id=self.nlb.id,<br>                backend_set_name=backend_set.name,<br>                ip_address=ip,<br>                port=port,<br>                opts=child,<br>            )<br>        oci.networkloadbalancer.Listener(<br>            f&quot;{self._name}-{name}&quot;,<br>            network_load_balancer_id=self.nlb.id,<br>            name=name,<br>            default_backend_set_name=backend_set.name,<br>            port=port,<br>            protocol=&quot;TCP&quot;,<br>            opts=child,<br>        )</pre><p>The first line of __init__ tells Pulumi that a resource of type oracle-cloud-k3s:loadbalancer:LoadBalancerComponent exists. It is an entry in the state only. The entry is the parent of everything the component creates, so the resources form one group in the resource graph of the program. The group has three effects:</p><ul><li>The state and pulumi preview show the resources as a tree under the component;</li><li>The resource options of the component (for example protect) pass down to the children;</li><li>Children keep their identity as long as the parent keeps its name.</li></ul><p>The component creates two OCI resources and sets their properties:</p><ol><li>The reserved public IP;</li><li>The network load balancer.</li></ol><p>The PublicIp object needs one extra option. When the load balancer takes the IP, OCI sets private_ip_id on the IP automatically, so Pulumi does not set this property. Without ignore_changes, the next pulumi up would reset the property and detach the IP from the load balancer.</p><p>The method _forward() creates a backend set, one backend per node IP and a listener for one port.</p><p>The component ends with register_outputs() and exports the public IP, which the cluster component gets as an input.</p><h4>Configuration</h4><p>The stack configuration lives in Pulumi.default.yaml. The function load_config() in <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/pulumi/components/config.py">config.py</a> reads it once and returns a ProjectConfig object with typed fields. The main program passes this object to every component, so no component reads the stack configuration itself.</p><p>Settings come from one of three places:</p><ul><li><strong>Required</strong> keys (for example region, compartment, availability domain) in the stack file Pulumi.default.yaml.</li><li><strong>Optional</strong> keys (for example DNS name) in the stack file Pulumi.default.yaml.</li><li>DEFAULT_* constants (for example k3s version, network ranges, swap size) in config.py.</li></ul><h4>k3s join token</h4><p>The join token is a shared secret with which the agent node joins the server node. It is declared as a RandomPassword resource. Pulumi generates it on the first pulumi up. The value is stored encrypted in the state and stays the same on every later run.</p><p>Inside the program the value is an Output[str] with the secret flag. Pulumi passes it to the Vault secret and into the cloud-init of both nodes. It is shown as [secret] instead of the value in the preview and in the logs.</p><h4>Cloud-init</h4><p>The templates <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/pulumi/templates/server.yaml">server.yaml</a> and <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/pulumi/templates/agent.yaml">agent.yaml</a> have @{name} placeholders. The <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/pulumi/components/cluster.py">cluster component</a> fills them inside Output.all(join_token, public_ip).apply(...) and passes the result to OCI as Base64 user_data.</p><p>The cloud-init writes the k3s configuration and one bootstrap script, then runs it. The script creates a 2 GB swap file, removes two iptables rules of the Ubuntu image, stops unneeded services and installs the pinned k3s version. On the server node, the script also writes the kubeconfig, and the cloud-init adds the Traefik configuration.</p><h3>Deployment</h3><p>There are two ways to deploy the stack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/0*Pp-VyQXvc9MvdUFQ.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0-Iz8W3_mtjFRo3D.png" /></figure><p>Both use the same state in the OCI Object Storage bucket.</p><p>The <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/.github/workflows/pulumi.yml">GitHub Actions workflow</a> has two jobs:</p><ul><li>pulumi preview runs on every pull request and every push to main.</li><li>pulumi up runs only on a manual start, with the apply input set to true.</li></ul><p>A concurrency group allows one run at a time.</p><p>Pulumi accesses the OCI Object Storage bucket through its S3-compatible API. The workflow gets the Customer Secret Key and the API signing key from repository secrets.</p><h3>Oracle Cloud Always Free limits</h3><p>The limits of the Free Tier shaped the design:</p><ul><li>Two micro instances;</li><li>One reserved public IP for the load balancer;</li><li>One vault of type DEFAULT with software-protected keys;</li><li>No NAT gateway, ephemeral public IPs instead.</li></ul><h3>Gotchas</h3><p>A few facts about OCI and k3s on 1 GB that are good to know before the first pulumi up:</p><ul><li>Capacity for the micro shape is not guaranteed. The repository has <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/scripts/check-capacity.sh">a script that checks the capacity</a>. Run it before any replacement.</li><li>OCI rejects changes to user_data and SSH keys on a live instance. So a change to cloud-init means that the nodes must be recreated.</li><li>A deleted vault waits 7 to 30 days for its deletion and still counts against the limit of one. A rebuild of the cluster deliberately <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/docs/OPERATIONS.md#rebuild-the-cluster-and-keep-the-vault">keeps the vault</a>.</li><li>The OCI Ubuntu image rejects forwarded traffic with iptables rules. It is fixed in the cloud-init scripts.</li></ul><h3>Real world</h3><p>The cluster is pretty small, but it does real work. I run a couple of my personal experimental tools and chat bots there. The limit is clear: anything that needs more than a few hundred MB of RAM does not fit here.</p><p>The next post will be about one of those tools.</p><h3>Try it out</h3><ol><li>Register an OCI account: <a href="https://signup.cloud.oracle.com/">https://signup.cloud.oracle.com/</a></li><li>Clone the repository: <a href="https://github.com/DeV1L/oracle-cloud-k3s">https://github.com/DeV1L/oracle-cloud-k3s</a></li><li>Create the OCI credentials: an API signing key and a Customer Secret Key.</li><li>Put the region, the availability domain and the SSH public key into <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/pulumi/Pulumi.default.yaml">Pulumi.default.yaml</a>.</li><li>Run pulumi up, or start the GitHub Actions workflow.</li></ol><p>The full guide, with every command, is in <a href="https://github.com/DeV1L/oracle-cloud-k3s/blob/main/docs/SETUP.md">docs/SETUP.md</a>.</p><p>Keep building!</p><p><em>Originally published at </em><a href="https://evgeniy.tech/2026/10/20/oracle-cloud-k3s.html"><em>https://evgeniy.tech</em></a><em> on October 20, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=281bf76dfd1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>