<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>K8s on Daniel Cardozo</title><link>/tags/k8s/</link><description>Recent content in K8s on Daniel Cardozo</description><generator>Hugo</generator><language>en-us</language><copyright>&lt;a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="noopener"&gt;cc by-nc 4.0&lt;/a&gt;</copyright><lastBuildDate>Fri, 10 May 2024 10:00:00 +0100</lastBuildDate><atom:link href="/tags/k8s/index.xml" rel="self" type="application/rss+xml"/><item><title>Deep Dive into Helm Templates</title><link>/posts/helm-templates/</link><pubDate>Fri, 10 May 2024 10:00:00 +0100</pubDate><guid>/posts/helm-templates/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Helm templates are Kubernetes manifests augmented with Go&amp;rsquo;s &lt;code&gt;text/template&lt;/code&gt; language. They live in the &lt;code&gt;templates/&lt;/code&gt; directory of your chart and are rendered by Helm using values from &lt;code&gt;values.yaml&lt;/code&gt; and any user-provided overrides. Understanding them is key to writing maintainable, reusable charts.&lt;/p&gt;
&lt;h2 id="template-basics"&gt;Template Basics&lt;/h2&gt;
&lt;p&gt;A minimal Deployment template:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;apiVersion&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;apps/v1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;kind&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;Deployment&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;metadata&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;name&lt;/span&gt;: {{ &lt;span style="color:#ae81ff"&gt;.Release.Name }}-app&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;labels&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;app&lt;/span&gt;: {{ &lt;span style="color:#ae81ff"&gt;.Chart.Name }}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;spec&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;replicas&lt;/span&gt;: {{ &lt;span style="color:#ae81ff"&gt;.Values.replicaCount }}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;selector&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;matchLabels&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;app&lt;/span&gt;: {{ &lt;span style="color:#ae81ff"&gt;.Chart.Name }}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;template&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;metadata&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;labels&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;app&lt;/span&gt;: {{ &lt;span style="color:#ae81ff"&gt;.Chart.Name }}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;spec&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;containers&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;name&lt;/span&gt;: {{ &lt;span style="color:#ae81ff"&gt;.Chart.Name }}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;image&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;{{ .Values.image.repository }}:{{ .Values.image.tag }}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="built-in-objects"&gt;Built-in Objects&lt;/h2&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Object&lt;/th&gt;
					&lt;th&gt;Description&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;.Release&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Current release info: &lt;code&gt;.Release.Name&lt;/code&gt;, &lt;code&gt;.Release.Namespace&lt;/code&gt;&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;.Chart&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Contents of &lt;code&gt;Chart.yaml&lt;/code&gt;: &lt;code&gt;.Chart.Name&lt;/code&gt;, &lt;code&gt;.Chart.Version&lt;/code&gt;&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;.Values&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Merged values from &lt;code&gt;values.yaml&lt;/code&gt; and user overrides&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;.Files&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Access to non-template files bundled in the chart&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="template-functions"&gt;Template Functions&lt;/h2&gt;
&lt;p&gt;Helm bundles Go&amp;rsquo;s Sprig library with over 60 helper functions:&lt;/p&gt;</description></item><item><title>Helm Tutorial: Managing Kubernetes Applications</title><link>/posts/helm-tutorial/</link><pubDate>Wed, 20 Mar 2024 10:00:00 +0100</pubDate><guid>/posts/helm-tutorial/</guid><description>&lt;h2 id="what-is-helm"&gt;What is Helm?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Helm&lt;/strong&gt; is the package manager for Kubernetes. It lets you define, install, and upgrade complex Kubernetes applications using reusable packages called &lt;strong&gt;charts&lt;/strong&gt;. Think of it as &lt;code&gt;apt&lt;/code&gt; or &lt;code&gt;brew&lt;/code&gt;, but for Kubernetes.&lt;/p&gt;
&lt;h2 id="key-concepts"&gt;Key Concepts&lt;/h2&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Term&lt;/th&gt;
					&lt;th&gt;Description&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;Chart&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;A package containing all Kubernetes resource definitions for an application&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;Release&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;A running instance of a chart installed in a cluster&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;Repository&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;A place where charts are stored and shared&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;Values&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;Configuration parameters that customize a chart at install time&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="installation"&gt;Installation&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# macOS&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;brew install helm
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Linux&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Verify the installation:&lt;/p&gt;</description></item><item><title>Getting Started with ArgoCD</title><link>/posts/argocd-getting-started/</link><pubDate>Mon, 15 Jan 2024 10:00:00 +0100</pubDate><guid>/posts/argocd-getting-started/</guid><description>&lt;h2 id="what-is-argocd"&gt;What is ArgoCD?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;ArgoCD&lt;/strong&gt; is a declarative, GitOps-based continuous delivery tool for Kubernetes. It automates application deployment by continuously syncing the desired state defined in a Git repository to your Kubernetes cluster — your Git repository becomes the single source of truth.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A running Kubernetes cluster (or &lt;a href="https://kind.sigs.k8s.io/"&gt;kind&lt;/a&gt; for local testing)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubectl&lt;/code&gt; configured to access your cluster&lt;/li&gt;
&lt;li&gt;A Git repository containing Kubernetes manifests&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="installing-argocd"&gt;Installing ArgoCD&lt;/h2&gt;
&lt;p&gt;Create the ArgoCD namespace and apply the official installation manifest:&lt;/p&gt;</description></item><item><title>Create backups with Velero</title><link>/posts/velero/</link><pubDate>Thu, 30 Jun 2022 19:46:08 +0000</pubDate><guid>/posts/velero/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Velero&lt;/strong&gt; is an open source tool to perform backups of your Kubernetes clusters, this also includes your kubernetes volumes! The way Velero works, is by asking the &lt;code&gt;Kubernetes API&lt;/code&gt; for the desired manifests you want to backup, that way you do not need a direct access to the &lt;code&gt;etcd&lt;/code&gt; Database. This is very useful when you are using managed Kubernetes clusters like &lt;code&gt;AWS&lt;/code&gt;, &lt;code&gt;GCP&lt;/code&gt;, &lt;code&gt;Digital Ocean&lt;/code&gt; etc. As when using managed clusters you do not have direct access to the masters nodes.&lt;/p&gt;</description></item></channel></rss>