<?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 Ronald Ramazanov on Medium]]></title>
        <description><![CDATA[Stories by Ronald Ramazanov on Medium]]></description>
        <link>https://medium.com/@ronaldramazanov?source=rss-b99f3d428275------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*nq4bjIUqqhBUea2e</url>
            <title>Stories by Ronald Ramazanov on Medium</title>
            <link>https://medium.com/@ronaldramazanov?source=rss-b99f3d428275------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 21:15:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ronaldramazanov/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[RKE2 (Rancher) — Setting Up a Self-Hosted K8s Cluster. Part 2]]></title>
            <link>https://medium.com/@ronaldramazanov/rke2-rancher-setting-up-a-self-hosted-k8s-cluster-part-2-b83ccebcaf93?source=rss-b99f3d428275------2</link>
            <guid isPermaLink="false">https://medium.com/p/b83ccebcaf93</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[rke2]]></category>
            <category><![CDATA[argo-cd]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[rancher]]></category>
            <dc:creator><![CDATA[Ronald Ramazanov]]></dc:creator>
            <pubDate>Thu, 24 Apr 2025 15:21:31 GMT</pubDate>
            <atom:updated>2025-04-24T15:21:31.052Z</atom:updated>
            <content:encoded><![CDATA[<h3>RKE2 (Rancher) — Setting Up a Self-Hosted K8s Cluster. Part 2</h3><p>This is Part 2 of the guide on setting up a self-hosted Kubernetes cluster with RKE2.<br>If you missed the first part, you can check it out <a href="https://medium.com/@ronaldramazanov/rke2-rancher-setting-up-a-self-hosted-k8s-cluster-part-1-3a9ff64901a6">here</a>.</p><h3>Installing Rancher and Other Components in the Cluster</h3><p>Next, let’s install several components in the RKE2 cluster that will be useful for managing the cluster and running applications.</p><p>First, I installed <strong>Rancher</strong>. As mentioned earlier, Rancher is not a mandatory component — the RKE2 cluster works perfectly well without it. But even if I don’t use Rancher’s full functionality, its <strong>graphical interface</strong> and <strong>RBAC (Role-Based Access Control)</strong> with support for third-party authentication providers can be very helpful.</p><p>The documentation suggests installing Rancher using the CLI via helm install commands. However, I chose a different approach. After reviewing how components like <strong>Canal</strong> and <strong>Nginx Ingress</strong> were automatically installed in the cluster, I followed the same pattern for deploying Rancher.</p><p>One of the default components in an RKE2 cluster is the <strong>Helm Controller</strong>. This controller watches the directory /var/lib/rancher/rke2/server/manifests and automatically installs any manifest files placed there.</p><p>Before installing Rancher, we need to deploy <strong>cert-manager</strong> so Rancher can issue certificates and work over HTTPS. First, create a manifest file for cert-manager:</p><blockquote>cd /var/lib/rancher/rke2/server/manifests<br>touch cert-manager.yaml</blockquote><pre>kind: HelmChart<br>metadata:<br>  name: cert-manager<br>  namespace: kube-system<br>spec:<br>  chart: cert-manager<br>  repo: https://charts.jetstack.io<br>  version: v1.15.2<br>  createNamespace: true<br>  set:<br>    installCRDs: &quot;true&quot;<br>  targetNamespace: cert-manager</pre><p>The metadata.namespace is where the HelmChart resource itself will be created — leave this as kube-system.<br> The targetNamespace is up to you — it’s where the chart’s Kubernetes objects will be deployed.</p><p>Next, create a manifest for Rancher. You’ll need to specify the admin password, hostname for the Ingress, and number of replicas:</p><pre>apiVersion: helm.cattle.io/v1<br>kind: HelmChart<br>metadata:<br>  name: rancher<br>  namespace: kube-system<br>spec:<br>  chart: rancher<br>  createNamespace: true<br>  repo: https://releases.rancher.com/server-charts/stable<br>  set:<br>    bootstrapPassword: examplePassword123<br>    hostname: rancher.proxmox.example.com<br>    replicas: 1<br>  targetNamespace: cattle-system<br>  version: 2.8.5</pre><p>The Helm Controller will detect the new manifests and deploy them. In the kube-system namespace, you’ll see pods with the prefix helm-install, such as helm-install-rancher-j654n. If deployment fails, check the logs of these pods. If everything is successful, they should show Completed status.</p><p>You can verify installed addons using:</p><blockquote>kubectl get addon -A</blockquote><p>You should see your Helm charts listed:</p><pre>NAMESPACE     NAME                SOURCE<br>kube-system   cert-manager        /var/lib/rancher/rke2/server/manifests/cert-manager.yaml<br>kube-system   rancher             /var/lib/rancher/rke2/server/manifests/rancher.yaml</pre><p>Also verify that the cert-manager and Rancher pods are running using kubectl get pods -A</p><p>To automate this setup, you can store these manifests in a Git repository and use <strong>Ansible</strong> to copy them to the hosts.</p><p>Although this method of installation is convenient, for future application deployment I plan to use <strong>ArgoCD</strong> following the <strong>App of Apps</strong> pattern, which I use in all my other Kubernetes projects. That said, having the Helm Controller is still a big advantage — it solves the chicken-and-egg problem of deploying tools like ArgoCD, the Ingress controller, and cert-manager <em>before</em> ArgoCD itself is available.</p><h3>Configuring External Incoming Traffic</h3><p>To access the Rancher web interface (or any other services in the cluster) over HTTP from an external network, you need to configure load balancing. In cloud environments, this is usually straightforward — a single manifest is enough to provision a Layer 4 or Layer 7 load balancer that integrates with the cluster.</p><p>However, in a <strong>bare-metal</strong> setup, a different approach is needed.</p><p>An excellent guide on this topic is available in the<a href="https://github.com/kubernetes/ingress-nginx/blob/main/docs/deploy/baremetal.md"> ingress-nginx documentation</a>, where several implementation options are described and visualized.</p><p>The most suitable option in my opinion is <a href="https://github.com/kubernetes/ingress-nginx/blob/main/docs/deploy/baremetal.md#using-a-self-provisioned-edge">“Using a self-provisioned edge”</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*boVLHhxYMXTzfUUTgIPyQg.png" /></figure><p>With this setup, the cluster nodes remain completely private, while incoming traffic is handled by a load balancer outside of the Kubernetes environment. This external load balancer has a public IP address and forwards all HTTP traffic to the K8s hosts. The most common choice for this role is <strong>HAProxy</strong>, but you can use any tool you prefer.</p><p>For this to work, the <strong>Ingress Controller service</strong> must be exposed as a <strong>NodePort</strong>. In RKE2, the NGINX Ingress Controller does not create a service by default, so you need to modify its configuration.</p><p>The default manifest is located in the /var/lib/rancher/rke2/server/manifests/ directory as rke2-ingress-nginx.yaml. You can view its contents, but <strong>you must not edit</strong> default manifests directly. Instead, customization should be done using a separate configuration file.</p><p>Create a new config file:</p><blockquote>touch rke2-ingress-nginx-config.yaml</blockquote><p>Then add:</p><pre>apiVersion: helm.cattle.io/v1<br>kind: HelmChartConfig<br>metadata:<br>  name: rke2-ingress-nginx<br>  namespace: kube-system<br>spec:<br>  valuesContent: |-<br>    controller:<br>      service:<br>        enabled: true<br>        type: &quot;NodePort&quot;<br>        nodePorts:<br>          http: 32767<br>          https: 32642</pre><p>For the configuration to apply, you must use the same name and namespace as the original manifest.<br> In valuesContent, override the chart values as needed — in this case, we enable the controller&#39;s service, set its type to NodePort, and assign specific ports.</p><p>Then, on your <strong>external TCP load balancer</strong>, configure it to listen on ports 80 and 443, and forward traffic to k8s-master.example.com on ports 32767 and 32642 respectively.</p><h3>Working with Rancher</h3><p>After configuring the Ingress, open the Rancher web interface and log in using the username admin and the password set via the bootstrapPassword parameter in the manifest.</p><p>Once logged in, your cluster will appear in the list as <strong>local</strong>. You can now manage it and visualize what’s happening through the graphical interface. But Rancher’s functionality doesn’t stop there.</p><p>The key feature of Rancher is <strong>centralized management of multiple Kubernetes clusters</strong>. You can import existing clusters or create new ones using Rancher. It supports both <strong>bare-metal/VM-based</strong> deployments (with RKE) and cloud-managed services (like AWS EKS).</p><p><strong>Rancher’s own recommended best practice</strong> for Kubernetes cluster setup is as follows:</p><ul><li>Deploy an RKE2 cluster using the method described in this article.</li><li>Install Rancher into this cluster in multiple replicas (with no user workloads).</li><li>Use Rancher to manage downstream clusters.</li></ul><p>There is also a way to run Rancher in a Docker container, but this is recommended only for testing purposes.</p><p>Additional built-in features of Rancher include:</p><ul><li><strong>RBAC</strong> with support for external identity providers.</li><li><strong>Fleet</strong>, a GitOps controller for CI/CD in clusters — an alternative to ArgoCD and Flux.</li><li><strong>Application catalog</strong> that allows you to install Helm charts through the GUI.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mEcVbs6iFJLH_EHAdWsC0Q.png" /></figure><p>At this point, I’m mainly using Rancher for its <strong>GUI</strong>. Personally, I prefer using <strong>Lens IDE</strong> locally, but Rancher provides a convenient access point for dev teams, without requiring them to install extra tools — and RBAC helps restrict permissions.</p><p>However, Rancher isn’t suitable for us as a centralized management solution across all clusters because of the nature of our work. We provide DevOps and custom software development services to multiple clients, each with their own unique infrastructure requirements, which makes a shared control plane unfeasible.</p><p>In general, Rancher is well-suited for Kubernetes newcomers — it offers a full set of features out of the box with GUI configuration. For those experienced with the Kubernetes ecosystem, it’s usually more convenient to rely on established tooling and automation rather than managing everything via GUI and built-in services like Fleet.</p><h3>Conclusion</h3><p>During the configuration phase, RKE2 proved to be an excellent tool that allowed me to quickly and conveniently set up a high-availability cluster ready for production use. I especially appreciated the high-quality, detailed documentation, which helped deepen my understanding of the product.</p><p>In addition to configuring RKE2, I also installed the Rancher platform into the cluster. This expanded the functionality — though it wasn’t a required step. Rancher’s interface and RBAC features can be quite useful, especially for team collaboration.</p><p>Future experience with RKE2 will come from real-world use: version upgrades, deploying application workloads, and troubleshooting any potential issues.</p><p>I’d love to hear about your experiences with self-hosted Kubernetes and the different tools or platforms you’ve used for deployment. Feel free to share your thoughts in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b83ccebcaf93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RKE2 (Rancher) — Setting Up a Self-Hosted K8s Cluster. Part 1]]></title>
            <link>https://medium.com/@ronaldramazanov/rke2-rancher-setting-up-a-self-hosted-k8s-cluster-part-1-3a9ff64901a6?source=rss-b99f3d428275------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a9ff64901a6</guid>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[rancher]]></category>
            <category><![CDATA[ingress]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Ronald Ramazanov]]></dc:creator>
            <pubDate>Wed, 23 Apr 2025 14:51:14 GMT</pubDate>
            <atom:updated>2025-04-24T15:39:43.118Z</atom:updated>
            <content:encoded><![CDATA[<h3>RKE2 (Rancher) — Setting Up a Self-Hosted K8s Cluster. Part 1</h3><p>With prior experience working with Kubernetes on various cloud providers such as AWS, I encountered a situation where I needed to deploy a cluster outside of the cloud, on virtual machines.</p><p>In this article, I’ll describe how to prepare a high-availability cluster using a tool called RKE2 — Rancher Kubernetes Engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*47kJSZ6yC9I2gxOUQJ1rpA.png" /></figure><h3>Differences Between Self-Hosted and Cloud-Based K8s</h3><p>In any major cloud platform, Kubernetes can be launched as a managed service. This relieves the administrator from configuring master nodes and control plane services, maintaining their availability, and handling version upgrades. All of that becomes the cloud provider’s responsibility, and setting up a cluster typically requires just a few steps in the cloud’s web interface or automation with Terraform. This allows the engineering team to focus on managing worker nodes, the application itself, and other components running within the cluster.</p><p>However, using such cloud services — or clouds in general — is not always possible, and there can be various reasons for that. In our case, several internal services and test environments (which don’t have high availability requirements) are deployed on a self-hosted server located in a data center. This significantly reduces costs compared to running equivalent resources in the cloud. At the same time, we still want to manage applications using the familiar and convenient K8s and Helm tooling, rather than going back to Docker Compose and Ansible.</p><p>Therefore, working with self-hosted Kubernetes requires a deeper understanding of K8s administration. The first step is choosing a deployment and management tool.</p><h3>Choosing the Right Tool</h3><p>There is no single “correct” tool for deploying Kubernetes. I explored the most popular solutions used in production environments:</p><ul><li><strong>Kubeadm</strong> — The tool recommended in the official Kubernetes documentation. It only handles part of the cluster setup. It does not include pre-configuration of the hosts or installation of system add-ons. The Kubernetes developers expect you to write your own higher-level tooling that, among other things, uses kubeadm to deploy the cluster. Typically, people create their own Ansible playbooks or shell scripts on top of kubeadm.</li><li><strong>Kubespray</strong> — A ready-made Ansible-based automation tool that handles the full cycle of cluster setup. Under the hood, it calls kubeadm and also takes care of configuring nodes and installing all the necessary components. I’ve heard from colleagues that it can be problematic to upgrade versions, especially if the playbook was customized.</li><li><strong>Rancher (RKE)</strong> — A product for deploying and managing Kubernetes clusters, owned by SUSE. It allows for quick cluster setup with all required components. The free version includes full functionality, and paid support is also available.</li><li><strong>Openshift</strong> — A commercial platform from Red Hat. There is a free counterpart — OKD — but it appears that solution is not used widely in the industry.</li></ul><p>Arguably the most flexible and customizable approach is using kubeadm along with your own automation. This takes more time than using a ready-made distribution or platform, but it gives you greater control over configuration and a better understanding of how the system works — and avoids dependency on third-party products.</p><p>However, I decided to start with a more convenient option — Rancher, specifically their Kubernetes distribution called RKE2. Gaining experience with this tool is useful anyway, since it’s quite commonly used. Plus, I’ve inherited a project that uses the first version of RKE, which will likely need upgrading in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f0nA7Lz8JJvrZW68DdOFZg.png" /></figure><h3>About Rancher and RKE</h3><p>When first getting acquainted with Rancher, some confusion might arise due to the variety of tools in its ecosystem. Let’s clarify the terminology.</p><ul><li><strong>Rancher</strong> is a platform with a graphical interface for deploying and managing Kubernetes clusters. It allows you to deploy clusters both in the cloud (using managed services) and in bare-metal environments by leveraging the RKE (Rancher Kubernetes Engine) distribution. Rancher itself can be launched as a Docker container for testing purposes, but for production it’s recommended to install it inside a Kubernetes cluster. This creates an interesting situation: to get a platform for deploying Kubernetes clusters, you first need to set up a Kubernetes cluster for Rancher itself. More details about Rancher are covered in a separate section of this article.</li><li><strong>RKE</strong> is a Kubernetes distribution that aims to simplify and automate the installation and management of Kubernetes. It uses Docker as both the container runtime and the environment in which control plane services run.</li><li><strong>RKE2</strong> is an updated and improved version of the distribution, which — unlike its predecessor — doesn’t rely on Docker. Control plane services run as static pods managed by kubelet, and containerd is used as the container runtime.</li></ul><p>RKE and RKE2 are standalone distributions, meaning they can be used independently of the Rancher platform — and that’s exactly what I did by choosing RKE2.</p><h3>Preparing to Install RKE2</h3><blockquote><strong><em>⚠️ Note:</em></strong><em> This article was written some time ago and is only now being published on Medium. As a result, you may notice references to older versions of Kubernetes, Ubuntu, or other tools. This doesn’t significantly affect the content, so I chose not to make any changes.</em></blockquote><p>I created three virtual machines with Ubuntu Server 22.04. Each VM was allocated 2 vCPUs and 4 GB of RAM — the minimum recommended resources according to the documentation. This configuration is sufficient to run the control plane and several services, but as the number of applications grows, you’ll need to increase resources or add more nodes to the cluster.</p><p>Before installation, you should <a href="https://docs.rke2.io/install/requirements">check the requirements </a>in the RKE2 documentation: ensure the OS is supported, necessary ports are open, each node has a unique hostname, etc.</p><p>For high availability, it’s best to set up a static endpoint (<a href="https://docs.rke2.io/install/ha#1-configure-the-fixed-registration-address">Fixed Registration Address</a>) through which the master nodes can be reached. This address is used by nodes when joining the cluster. It helps prevent issues caused by a specific node going down, as the endpoint will always resolve to the available master nodes.</p><p>You can create this endpoint using various methods, such as a TCP load balancer, Virtual or round-robin DNS. I chose DNS for my environment, but I recommend considering a different option for production.</p><pre>;; ANSWER SECTION:<br>k8s-master.example.com. 60 IN A 192.168.100.19<br>k8s-master.example.com. 60 IN A 192.168.100.21<br>k8s-master.example.com. 60 IN A 192.168.100.20</pre><p>This same address will be used to access the Kubernetes API and will be specified in the kubeconfig file in the next step.</p><h3>Installing RKE2</h3><p>To begin the installation of RKE2, SSH into the first host and switch to the root user:</p><blockquote>sudo -i</blockquote><p>Then download and run the installer:</p><blockquote>curl -sfL <a href="https://get.rke2.io/">https://get.rke2.io</a> | sh -</blockquote><p>This will install the latest stable version of RKE. At the time of writing, that was version 1.28, even though Kubernetes had already released version 1.30. If you prioritize new features over stability, you can install the latest version by setting the environment variable:</p><blockquote>INSTALL_RKE2_CHANNEL=latest</blockquote><p>Since we’re using a fixed registration address, to avoid certificate errors, we need to add the tls-san parameter to the config file.</p><p>Create the config file:</p><blockquote>touch /etc/rancher/rke2/config.yaml</blockquote><p>Add the following content:</p><pre>tls-san:<br>  - k8s-master.example.com</pre><p>Now you can start the service and check the logs and pod status:</p><pre>systemctl enable --now rke2-server.service<br>journalctl -u rke2-server -f<br>/var/lib/rancher/rke2/bin/kubectl get pods -A --kubeconfig /etc/rancher/rke2/rke2.yaml</pre><p>Next, copy the token from /var/lib/rancher/rke2/server/node-token — it will be needed when setting up the other nodes.</p><h3>Setting Up Additional Master Nodes</h3><p>Now we move on to configuring additional master nodes. The cluster should ultimately have an odd number of control plane nodes — typically three are recommended.</p><p>SSH into the second and third nodes and perform the same setup steps as for the first node, with one key difference: the configuration file needs to include the token and the server address (which is the fixed registration address).</p><p>Here’s an example config.yaml:</p><pre>tls-san:<br>  - k8s-master.example.com<br>token: some_token<br>server: https://k8s-master.example.com:9345</pre><p>After configuration, verify that the cluster is functioning correctly:</p><pre>/var/lib/rancher/rke2/bin/kubectl get nodes --kubeconfig /etc/rancher/rke2/rke2.yaml<br>/var/lib/rancher/rke2/bin/kubectl get pods -A --kubeconfig /etc/rancher/rke2/rke2.yaml</pre><p>As a result, you’ll have a minimal highly-available RKE2 cluster consisting of three nodes, running etcd, the Kubernetes API, CNI, an Ingress controller, and other control plane services and components.</p><p>By default, these same master nodes (called <strong>server nodes</strong> in RKE terminology) can also run user workloads such as applications and services. This configuration works fine for my needs, as I’m not planning to deploy high-load applications with strict availability requirements to this cluster.</p><p>However, <strong>best practices</strong> for production clusters recommend using dedicated <strong>worker nodes</strong> (called <strong>agent nodes</strong> in RKE). The configuration of agent nodes is almost identical to server nodes and is described in the documentation.</p><p>Additionally, to prevent workloads from being scheduled on master nodes, you should configure a taint in the master node config:</p><pre>node-taint:<br>  - &quot;CriticalAddonsOnly=true:NoExecute&quot;</pre><h3>Configuring kubectl</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQKCp2D8fj3mnuhqZI6N2Q.png" /></figure><p>After installing RKE2 on each node in the cluster, you’ll find the kubectl utility in /var/lib/rancher/rke2/bin/. The corresponding configuration file for kubectl is located at /etc/rancher/rke2/rke2.yaml.</p><p>You can use kubectl directly on the cluster nodes, but typically it’s run from a separate <strong>bastion</strong> (management) host, or from developer workstations with restricted API access. In the latter case, make sure to limit access to the Kubernetes API port (6443) using firewall rules that allow only trusted IPs.</p><p>In my case, I’m using a <strong>bastion host</strong>. After SSH-ing into it, install kubectl, specifying the version that matches your RKE2 installation (in my case, it’s 1.28):</p><pre>curl -LO https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl<br>sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl<br>kubectl version --client</pre><p>Next, create the config file at ~/.kube/config and copy the contents of /etc/rancher/rke2/rke2.yaml from any RKE2 node. The only change needed is to replace 127.0.0.1 with the fixed registration address: k8s-master.example.com.</p><p>Now test kubectl:</p><blockquote>kubectl get pods -A</blockquote><p>In the next part, I’ll cover how to install additional components using Helm Controller, configure HTTPS access, and set up external traffic with Ingress and a load balancer.</p><p><a href="https://medium.com/@ronaldramazanov/rke2-rancher-setting-up-a-self-hosted-k8s-cluster-part-2-b83ccebcaf93">Read Part 2 here →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a9ff64901a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>