Google Cloud Kubernetes: Deploy Your First Cluster on GKE

Wednesday, 15 April, 2020

Google, the original developer of Kubernetes, also provides the veteran managed Kubernetes service, Google Kubernetes Engine (GKE).

GKE is easy to set up and use, but can get complex for large deployments or when you need to support enterprise requirements like security and compliance. Read on to learn how to take your first steps with GKE, get important tips for daily operations and learn how to simplify enterprise deployments with Rancher.

In this article you will learn:

  • What is Google Kubernetes Engine?
  • How GKE is priced
  • How to create a Kubernetes cluster on Google Cloud
  • GKE best practices
  • How to simplify GKE for enterprise deployments with Rancher

What is Google Kubernetes Engine (GKE)?

Kubernetes was created by Google to orchestrate its own containerized applications and workloads. Google was also the first cloud vendor to provide a managed Kubernetes service, in the form of GKE.

GKE is a managed, upstream Kubernetes service that you can use to automate many of your deployment, maintenance and management tasks. It integrates with a variety of Google cloud services and can be used with hybrid clouds via the Anthos service.

Google Cloud Kubernetes Pricing

Part of deciding whether GKE is right for you requires understanding the cost of the service. The easiest way to estimate your costs is with the Google Cloud pricing calculator.

Pricing for cluster management

Beginning in June 2020, Google will charge a cluster management fee of $0.10 per cluster per hour. This fee does not apply to Anthos clusters, however, and you do get one zonal cluster free. Billing is calculated on a per-second basis. At the end of the month, the total is rounded to the nearest cent.

Pricing for worker nodes

Your cost for worker nodes depends on which Compute Engine Instances you choose to use. All instances have a one-minute minimum use cost and are billed per second. You are billed for each instance you use and continue to be charged until you delete your nodes.

Creating a Google Kubernetes Cluster

Creating a cluster in GKE is a relatively straightforward process:

1. Setup
To get started you need to first enable API services for your Kubernetes project. You can do this from the Google Cloud Console on the Kubernetes Engine page. Select your project and enable the API. While waiting for these services to be enabled, you should also verify that you’ve enabled billing for your project.

2. Choosing a shell
When setting up clusters, you can use either your local shell or Google’s Cloud Shell. The Cloud Shell is designed for quick startup and comes preinstalled with the kubectl and gcloud CLI tools. The gcloud tool is used to manage cloud functions and kubectl is used to manage Kubernetes. If you want to use your local shell, just make sure to install these tools first.

3. Creating a GKE cluster

Clusters are composed of one or more masters and multiple worker nodes. When creating nodes, you use virtual machine (VM) instances which then host your applications and services.

To create a simple, one-node cluster, you can use the following command. However, note that a single node cluster is not fit for production so you should only use this cluster for testing.

gcloud container clusters create {Cluster name} --num-nodes=1

4. Get authentication credentials for the cluster

Once your cluster is created, you need to set up authentication credentials before you can interact with it. You can do so with the following command, which configures kubectl with your credentials.

gcloud container clusters get-credentials {Cluster name}

Google Cloud Kubernetes Best Practices

Once you’ve gotten familiar with deploying clusters to GKE, there are a few best practices you can implement to optimize your deployment. Below are a few practices to start with.

Manage resource use

Kubernetes is highly scalable but this can become an issue if you scale larger than your available resources. To ensure that you are not creating too many replicas or allowing pods to use too many resources, you can enforce, request and limit policies. These policies can help you ensure that your resources are fairly distributed and can prevent issues due to overprovisioning.

Avoid privileged containers

Privileged containers enable contained processes to gain unrestricted access to your host. This is because a privileged container’s uid is mapped to that of the host. To avoid the security risk that is created by these privileges, you should avoid operating containers in privileged mode whenever possible. You should also ensure that privilege escalation is not allowed.

Perform health checks

Once you reach the production stage, your Kubernetes deployment is likely highly complex and can be difficult to manage. Rather than waiting for something to go wrong and then trying to find it, you should perform periodic health checks.

Health checks are a way of verifying that your components are working as expected. These checks are performed with probes, like the readiness and liveness probes.

Containers should be stateless and immutable

While you can use stateful applications in Kubernetes, it is designed for use with stateless processes. Stateless processes do not include persistent memory and contained data only exists while your container does. For data to be retained, containers must be attached to external storage.

Ideally, your containers should be both immutable and stateless. This enables Kubernetes to smoothly take down or replace containers as needed, reattaching to external storage as needed.

The immutable aspect means that a container does not change during its lifetime. If you need to make changes, such as updates or configuration changes, you make the change as needed and then build a new image to deploy. There is an option to get around this for some configuration, however. Using ConfigMaps and Secrets, you can externalize your configuration. From there you can make changes without needing to rebuild your image after each change.

Use role-based access control (RBAC)

RBAC is an efficient and effective way to manage permissions within your deployment. In GKE, it is applied as an authorization method that is layered on the Kubernetes API.

With RBAC, all access is denied by default and it is up to you to define granular permissions to individual users. Keep in mind, any user roles you create only apply to one namespace. To work across namespaces, you need to define cluster roles.

Simplify monitoring

Monitoring and logging events is a requirement for proper management of your applications. Commonly, monitoring in Kubernetes is done through Prometheus, a built-in integration that enables you to automatically discover services and pods.

Prometheus works by exposing metrics to an HTTP endpoint. These metrics can then be ingested by the monitoring tool of your choice. For example, you can use a tool like Stackdriver, which includes its own Prometheus version.

Simplifying GKE for Enterprise Deployments with Rancher

Rancher is a Kubernetes management platform that simplifies setup and ongoing operations for Kubernetes clusters at any scale. It can help you run mission critical workloads in production and easily scale up Kubernetes with enterprise-grade capabilities.

Rancher enhances GKE if you also manage Kubernetes clusters on different substrates—including Amazon’s Elastic Kubernetes Service (EKS) or the Azure Kubernetes Service (AKS), on-premises or at the edge. Rancher lets you centrally configure policies on all clusters. It provides the following capabilities beyond what is offered in native GKE:

Centralized user authentication and role-based access control (RBAC)

Rancher integrates with Active Directory, LDAP and SAML, letting you define access control policies within GKE. There is no need to maintain user accounts or groups across multiple platforms. This makes compliance easier and promotes self service for Kubernetes administrators — it is possible to delegate permission for clusters or namespaces to specific administrators.

Consistent, unified experience across cloud providers

Alongside Google Cloud, Rancher supports AWS, Azure and other cloud computing environments. This allows you to manage Kubernetes clusters on Google Cloud and other environments using one pane of glass. It also enables one-click deployment across all your clusters of Istio, Fluentd, Prometheus and Grafana, and Longhorn.

Comprehensive control via one intuitive user interface

Rancher allows you to deploy and troubleshoot workloads consistently, whether they run on Google Cloud or elsewhere, and regardless of the Kubernetes version or distribution you use. This allows DevOps teams to become productive quickly, even when working on Kubernetes distributions or infrastructure providers they are not closely familiar with.

Enhanced cluster security

Rancher allows security teams to centrally define user roles and security policies across multiple cloud environments, and instantly assign them to one or more Kubernetes clusters.

Global app catalog and multi-cluster apps

Rancher provides an application catalog you can use across numerous clusters, allows you to easily pick an application and deploy it on a Kubernetes cluster. It also allows applications to run on several Kubernetes clusters.

Learn more about the Rancher managed Kubernetes platform.

Tags: Category: Products, Rancher Kubernetes Comments closed

Running Google Cloud Containers with Rancher

Monday, 13 April, 2020
Read our free white paper: How to Build a Kubernetes Strategy

Rancher is the enterprise computing platform to run Kubernetes on-premises, in the cloud and at the edge. It’s an excellent platform to get started with containers or for those who are struggling to scale up their Kubernetes operations in production. However, in a world increasingly dominated by public infrastructure providers like Google Cloud, it’s reasonable to ask how Rancher adds value to services like Google’s Kubernetes Engine (GKE).

This blog provides a comprehensive overview on how Rancher can help your ITOps and DevOps teams who are invested in Google’s Kubernetes Engine (GKE) but also looking to diversify their capabilities through on-prem, additional cloud providers or with edge computing.

Google Cloud (sometimes referred to as GCP) is a leading provider of computing resources for deploying and operating containerized applications. Google Cloud continues to grow rapidly: they recently launched new cloud regions in India, Qatar, Australia and Canada. That makes a total of 22 cloud regions across 16 countries, in support of their growing number of users.

As the creators of Kubernetes, Google has a rich history in its container offerings, design and community. Google Cloud’s GKE service was the first managed Kubernetes service on the market — and is still one of the most advanced.

GKE has quickly gained popularity with users because it’s designed to eliminate the need to install, manage and operate your Kubernetes clusters. GKE is particularly popular with developers because it’s easy to use and packed with robust container orchestration features including integrated logging, autoscaling, monitoring and private container registries. ITOps teams like running Kubernetes on Google Cloud because GKE includes features like creating or resizing container clusters, upgrading container clusters, creating container pods and resizing application controllers.

Despite its undeniable convenience, if an enterprise chooses only Google Cloud Container services for all their Kubernetes needs, they’re locking themselves into a single vendor ecosystem. For example, by choosing Google Cloud Load Balancer for load distribution, Google Cloud Container Registry to manage your Docker images or Anthos Service Mesh with GKE, a customer’s future deployment options narrow. It’s little wonder that many GKE customers look to Rancher to help them deliver greater consistency when pursuing a multi-cloud strategy for Kubernetes.

The Benefits of Multi Cloud

As the digital economy grows, cloud adoption has increasingly become the norm across organizations from large-scale enterprise to startups. In a recent Gartner survey of public cloud users, 81 percent of respondents said they were already working with two or more cloud providers.

So, what does this mean for your team? By leveraging a multi-cloud approach, organizations are avoiding vendor lock-in, thus improving their cost savings and creating an environment that fosters agility and performance optimization. You are no longer constrained to the functionalities of GKE only. Instead, multi-cloud enables teams to diversity their organization’s architecture and provide greater access to best-in-class technology vendors.

The shift to multi-cloud has also influenced Kubernetes users. Users are mirroring the same trends by architecting their containers to run on any certified Kubernetes distribution – shifting away from the single vendor strategy. By taking a multi-cloud approach to your Kubernetes environment and using an orchestration tool like Rancher, your team will spend less time managing specific platform workflows and configurations and more time optimizing your applications and containers.

Google Cloud Containers: Using Rancher to Manage Google Kubernetes Engine

Rancher enhances your container orchestration with GKE as it allows you to easily manage Kubernetes clusters across multiple providers, whether it’s on EKS, AKS or with edge computing. Rancher’s orchestration tool is integrated with workload management capabilities, allowing users to centrally configure policies across all their clusters and ensure consistency across their environment. These capabilities include:

1) Streamlined administration of your Kubernetes environment

Compliance requirements and administration of any Kubernetes environment is a key functionality requirement for users. With Rancher, consistent role-based access control (RBAC) is enforced across GKE and any other Kubernetes environments through its integration with Active Directory, LDAP or SAML-based authentication.

By centralizing RBAC, administrators of Kubernetes environments are reducing the overheads required to maintain user or group profiles across multiple cloud platforms. Rancher makes it easier for administrators to manage any compliance requirements as well as enabling the ability for self-administration from users of any Kubernetes cluster or namespace.

RBAC controls in Rancher
RBAC controls in Rancher

2) Comprehensive control from an intuitive user interface

Troubleshooting errors and maintaining control of the environment can become a bottleneck as your team matures in its usage of Kubernetes and continually builds more containers while deploying more applications. By using Rancher, teams have access to an intuitive web user interface that allows them to deploy and troubleshoot workloads across any Kubernetes provider’s environment within the Rancher platform.

This means less time required by your teams to figure out the operational nuances of each provider and more time building, all team members using the same features and configurations and ability for new team members to quickly launch applications into production across your Kubernetes distribution.

Multi-cluster management with Rancher
Multi-cluster management with Rancher

3) Secure clusters

With complex technology environments and multiple users, security is a core requirement for any successful enterprise-grade tool. Rancher provides administrators and their security teams with the ability to define and control how users of the tool should interact with the Kubernetes environment they are managing via policies. For example, administrators can customize how containerized workloads operate across each environment and infrastructure provider. Once these policies are defined, they can be assigned across to any cluster within the Kubernetes environment.

Adding custom pod security policies
Adding custom pod security policies

4) A global catalog of applications and multi-cluster applications

Get access to Rancher’s global network of applications to minimize your team’s operational requirements across your Kubernetes environment. Maximize your team’s productivity and improve your architecture’s reliability by integrating these multi-cluster applications into your environment.

Selecting multi-cluster apps from Rancher’s catalog
Selecting multi-cluster apps from Rancher’s catalog

5) Streamlined day-2 operations for multi-cloud infrastructure

Once you’ve  provisioned Kubernetes clusters in a multi-cloud environment with Rancher, your operational requirements moving forward are streamlined through Rancher. From day 2, the operation of your environment is centralized in Rancher’s single pane of glass, providing users with the accessibility to push-button deployments including upstream Istio for service mesh, FluentD logging, Prometheus and Grafana  for observability and Longhorn for highly available persistent storage.

Added to these benefits, if you ever decide to stop using Rancher, we provide a clean uninstall process for imported GKE clusters so that you can manage them independently as if we were never there.

Although a single cloud platform like GKE is often sufficient, as your architecture becomes more complex, selecting the right cloud strategy becomes critical to your team’s output and performance. A multi-cloud strategy incorporating an orchestration tool like Rancher can remove technical and commercial limitations seen in single cloud environments.

Read our free white paper: How to Build a Kubernetes Strategy

SUSE Linux dla aplikacji SAP dostępny w chmurze Google

Tuesday, 11 July, 2017

Coraz częściej oprogramowanie SAP, w tym SAP HANA, jest przenoszone do chmury. SAP HANA działa wyłącznie na platformie Linux i niemal we wszystkich wdrożeniach jest to SUSE Linux z uwagi na ścisłą współpracę SUSE i SAP. Właśnie ogłosiliśmy, że system operacyjny SUSE Linux Enterprise Server for SAP Applications jest dostępny u wszystkich trzech głównych dostawców chmury publicznej: Google Cloud Platform, Amazon Web Services (AWS) oraz Microsoft Azure.

Do tej pory obsługiwane były chmury Amazona i Microsoftu, a teraz użytkownicy SAP HANA mogą korzystać z wydajnych maszyn wirtualnych oraz sprawdzonych zalet (cena/wydajność) chmury Google Cloud Platform, w której działa system SUSE Linux Enterprise Server for SAP Applications. SUSE Linux jest jednocześnie pierwszym i jedynym na rynku systemem operacyjnym Linux ze wsparciem dla SAP HANA dostępnym na platformie Google Cloud. Wszystkich zainteresowanych przetestowaniem zapraszamy do zapoznania się z przewodnikiem, jak wdrożyć SAP HANA na serwerze SUSE w chmurze Google: https://cloud.google.com/solutions/partners/sap/sap-hana-deployment-guide .

Główne zalety uruchomienia oprogramowania SAP w chmurze Google na systemie SUSE Linux Enterprise Server for SAP Applications to przede wszystkim  łatwość skalowania i dostosowywania środowiska IT do aktualnych potrzeb firmy, ograniczenie kosztów operacyjnych (płacimy tylko wtedy, kiedy korzystamy z systemów), a także możliwość znacznie szybszego wdrażania zwykle kluczowych dla organizacji aplikacji.

Zdaniem Najiego Almahmouda, wiceprezesa SUSE ds. sojuszy strategicznych: „Uruchamiając SUSE Linux Enterprise Server for SAP Applications w chmurze Google jeszcze lepiej widać zalety tego systemu operacyjnego – oszczędność czasu, nakładów pracy i kosztów przy wdrażaniu oprogramowania SAP w swoim środowisku IT, a obecnie także na żądanie w chmurze. Obecność oprogramowania SUSE na platformie Google Cloud zapewnia firmom elastyczność i daje swobodę wyboru takiej metody wdrożenia najlepszego w branży systemu Linux dla SAP HANA i SAP S/4HANA, która najlepiej zaspokoi ich potrzeby.”

Więcej informacji o SAP HANA, Google Cloud Platform i SUSE można znaleźć na stronach Google cloud.google.com/sap/saphana oraz SUSE suse.com/google.

Wydanie NeuVector w wersji 5.3.0: Zwiększenie bezpieczeństwa sieci i automatyzacja

Monday, 5 February, 2024

NeuVector w wersji 5.3.0 już jest! To wydanie wprowadza nowe funkcje do zabezpieczeń sieci kontenerów, a także wsparcie dla bezpieczeństwa GitOps jako automatyzacji kodu. Rozszerza również zakres kompatybilności platformy z Arm64 i wsparciem dla rynku chmury publicznej.

Nowa wersja zapewnia wartościowy wgląd w połączenia zewnętrzne z klastra Kubernetes. Deweloperzy często wymagają zewnętrznych połączeń dla usług API, zewnętrznych źródeł danych, a nawet internetowych aktualizacji open source. Te zewnętrzne połączenia mogą dotyczyć wewnętrznych sieci prywatnych lub usług internetowych, a zespoły operacyjne i bezpieczeństwa mogą mieć trudności z ustaleniem, które z nich powinny być dozwolone, a które podejrzane. Wraz z rozpowszechnieniem wbudowanego złośliwego oprogramowania, backdoorów i wydobywania kryptowalut, niezwykle ważne jest, aby połączenia zewnętrzne z klastra były odpowiednio identyfikowane i zabezpieczane. W wersji 5.3.0 NeuVector wykorzystuje inspekcję warstwy 7 (aplikacji) całego ruchu, w tym rozdzielczości DNS dla w pełni kwalifikowanych nazw domen (FQDN), do adresów IP, aby najpierw poznać zewnętrzne nazwy hostów / adresy URL i raportować połączenia zewnętrzne. Dzięki tej wiedzy zespoły ds. bezpieczeństwa i operacji mogą określić, które połączenia powinny być dozwolone, które podejrzane, a które zablokowane. Dozwolone połączenia są następnie kodyfikowane w regułach zerowego zaufania dla dostępu zewnętrznego. Ponadto NeuVector można teraz skonfigurować tak, aby zezwalał na ruch ICMP w celu monitorowania lub blokowania ataków opartych na ICMP.

Automatyzacja GitOps dla bezpieczeństwa jako kodu

Pipeline’y Kubernetes są wysoce dynamiczne i zautomatyzowane, a polityka bezpieczeństwa Kubernetes musi być również zautomatyzowana, aby wspierać te pipeline’y. NeuVector 5.3.0 rozszerza obsługę “Security as Code”, umożliwiając eksport polityk bezpieczeństwa (manifestów opartych na języku yaml) do repozytoriów git (GitHub) w postaci niestandardowych definicji zasobów NeuVector (CRD). Stanowi to rozszerzenie działań rozpoczętych kilka lat temu w celu umożliwienia zarządzania wszystkimi politykami bezpieczeństwa NeuVector za pośrednictwem CRD. Wykorzystanie przepływu pracy GitOps do zarządzania manifestami bezpieczeństwa będzie nadal rozszerzane w przyszłości poprzez import z repozytoriów git.

Rozszerzone wsparcie dla platform sprzętowych dostęp w marketplace’ach w chmurze publicznej

Nowa wersja dodaje obsługę architektur opartych na Arm64 z kontenerami Linux i rozszerza wsparcie dla Amazon EKS, Microsoft Azure i Google Marketplaces. Ściśle współpracując z zespołem technicznym firmy Arm, inżynierowie NeuVector z powodzeniem przeportowali nasze oprogramowanie i przetestowali pod kątem działania na platformie Arm64. Jako projekt bezpieczeństwa typu open source, NeuVector umożliwia zespołom wnoszenie znaczącego wkładu w projekt. Zapewnia to pełne bezpieczeństwo kontenerów działających na Arm, w tym bare metal i chmurach publicznych, takich jak Amazon EKS Graviton.

Aby zobaczyć wszystkie ulepszenia, warto zapoznać się z informacjami o wersji NeuVector 5.3.0 w Release Notes.

Treść wpisu na blogu przygotowana na podstawie postu Glena Kosaka

Getting Started with Cluster Autoscaling in Kubernetes

Tuesday, 12 September, 2023

Autoscaling the resources and services in your Kubernetes cluster is essential if your system is going to meet variable workloads. You can’t rely on manual scaling to help the cluster handle unexpected load changes.

While cluster autoscaling certainly allows for faster and more efficient deployment, the practice also reduces resource waste and helps decrease overall costs. When you can scale up or down quickly, your applications can be optimized for different workloads, making them more reliable. And a reliable system is always cheaper in the long run.

This tutorial introduces you to Kubernetes’s Cluster Autoscaler. You’ll learn how it differs from other types of autoscaling in Kubernetes, as well as how to implement Cluster Autoscaler using Rancher.

The differences between different types of Kubernetes autoscaling

By monitoring utilization and reacting to changes, Kubernetes autoscaling helps ensure that your applications and services are always running at their best. You can accomplish autoscaling through the use of a Vertical Pod Autoscaler (VPA)Horizontal Pod Autoscaler (HPA) or Cluster Autoscaler (CA).

VPA is a Kubernetes resource responsible for managing individual pods’ resource requests. It’s used to automatically adjust the resource requests and limits of individual pods, such as CPU and memory, to optimize resource utilization. VPA helps organizations maintain the performance of individual applications by scaling up or down based on usage patterns.

HPA is a Kubernetes resource that automatically scales the number of replicas of a particular application or service. HPA monitors the usage of the application or service and will scale the number of replicas up or down based on the usage levels. This helps organizations maintain the performance of their applications and services without the need for manual intervention.

CA is a Kubernetes resource used to automatically scale the number of nodes in the cluster based on the usage levels. This helps organizations maintain the performance of the cluster and optimize resource utilization.

The main difference between VPA, HPA and CA is that VPA and HPA are responsible for managing the resource requests of individual pods and services, while CA is responsible for managing the overall resources of the cluster. VPA and HPA are used to scale up or down based on the usage patterns of individual applications or services, while CA is used to scale the number of nodes in the cluster to maintain the performance of the overall cluster.

Now that you understand how CA differs from VPA and HPA, you’re ready to begin implementing cluster autoscaling in Kubernetes.

Prerequisites

There are many ways to demonstrate how to implement CA. For instance, you could install Kubernetes on your local machine and set up everything manually using the kubectl command-line tool. Or you could set up a user with sufficient permissions on Amazon Web Services (AWS), Google Cloud Platform (GCP) or Azure to play with Kubernetes using your favorite managed cluster provider. Both options are valid; however, they involve a lot of configuration steps that can distract from the main topic: the Kubernetes Cluster Autoscaler.

An easier solution is one that allows the tutorial to focus on understanding the inner workings of CA and not on time-consuming platform configurations, which is what you’ll be learning about here. This solution involves only two requirements: a Linode account and Rancher.

For this tutorial, you’ll need a running Rancher Manager server. Rancher is perfect for demonstrating how CA works, as it allows you to deploy and manage Kubernetes clusters on any provider conveniently from its powerful UI. Moreover, you can deploy it using several providers, including these popular options:

If you are curious about a more advanced implementation, we suggest reading the Rancher documentation, which describes how to install Cluster Autoscaler on Rancher using Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling groups. However, please note that implementing CA is very similar on different platforms, as all solutions leverage Kubernetes Cluster API for their purposes. Something that will be addressed in more detail later.

What is Cluster API, and how does Kubernetes CA leverage it

Cluster API is an open source project for building and managing Kubernetes clusters. It provides a declarative API to define the desired state of Kubernetes clusters. In other words, Cluster API can be used to extend the Kubernetes API to manage clusters across various cloud providers, bare metal installations and virtual machines.

In comparison, Kubernetes CA leverages Cluster API to enable the automatic scaling of Kubernetes clusters in response to changing application demands. CA detects when the capacity of a cluster is insufficient to accommodate the current workload and then requests additional nodes from the cloud provider. CA then provisions the new nodes using Cluster API and adds them to the cluster. In this way, the CA ensures that the cluster has the capacity needed to serve its applications.

Because Rancher supports CA and RKE2, and K3s works with Cluster API, their combination offers the ideal solution for automated Kubernetes lifecycle management from a central dashboard. This is also true for any other cloud provider that offers support for Cluster API.

Link to the Cluster API blog

Implementing CA in Kubernetes

Now that you know what Cluster API and CA are, it’s time to get down to business. Your first task will be to deploy a new Kubernetes cluster using Rancher.

Deploying a new Kubernetes cluster using Rancher

Begin by navigating to your Rancher installation. Once logged in, click on the hamburger menu located at the top left and select Cluster Management:

Rancher's main dashboard

On the next screen, click on Drivers:

**Cluster Management | Drivers**

Rancher uses cluster drivers to create Kubernetes clusters in hosted cloud providers.

For Linode LKE, you need to activate the specific driver, which is simple. Just select the driver and press the Activate button. Once the driver is downloaded and installed, the status will change to Active, and you can click on Clusters in the side menu:

Activate LKE driver

With the cluster driver enabled, it’s time to create a new Kubernetes deployment by selecting Clusters | Create:

**Clusters | Create**

Then select Linode LKE from the list of hosted Kubernetes providers:

Create LKE cluster

Next, you’ll need to enter some basic information, including a name for the cluster and the personal access token used to authenticate with the Linode API. When you’ve finished, click Proceed to Cluster Configuration to continue:

**Add Cluster** screen

If the connection to the Linode API is successful, you’ll be directed to the next screen, where you will need to choose a region, Kubernetes version and, optionally, a tag for the new cluster. Once you’re ready, press Proceed to Node pool selection:

Cluster configuration

This is the final screen before creating the LKE cluster. In it, you decide how many node pools you want to create. While there are no limitations on the number of node pools you can create, the implementation of Cluster Autoscaler for Linode does impose two restrictions, which are listed here:

  1. Each LKE Node Pool must host a single node (called Linode).
  2. Each Linode must be of the same type (eg 2GB, 4GB and 6GB).

For this tutorial, you will use two node pools, one hosting 2GB RAM nodes and one hosting 4GB RAM nodes. Configuring node pools is easy; select the type from the drop-down list and the desired number of nodes, and then click the Add Node Pool button. Once your configuration looks like the following image, press Create:

Node pool selection

You’ll be taken back to the Clusters screen, where you should wait for the new cluster to be provisioned. Behind the scenes, Rancher is leveraging the Cluster API to configure the LKE cluster according to your requirements:

Cluster provisioning

Once the cluster status shows as active, you can review the new cluster details by clicking the Explore button on the right:

Explore new cluster

At this point, you’ve deployed an LKE cluster using Rancher. In the next section, you’ll learn how to implement CA on it.

Setting up CA

If you’re new to Kubernetes, implementing CA can seem complex. For instance, the Cluster Autoscaler on AWS documentation talks about how to set permissions using Identity and Access Management (IAM) policies, OpenID Connect (OIDC) Federated Authentication and AWS security credentials. Meanwhile, the Cluster Autoscaler on Azure documentation focuses on how to implement CA in Azure Kubernetes Service (AKS), Autoscale VMAS instances and Autoscale VMSS instances, for which you will also need to spend time setting up the correct credentials for your user.

The objective of this tutorial is to leave aside the specifics associated with the authentication and authorization mechanisms of each cloud provider and focus on what really matters: How to implement CA in Kubernetes. To this end, you should focus your attention on these three key points:

  1. CA introduces the concept of node groups, also called by some vendors autoscaling groups. You can think of these groups as the node pools managed by CA. This concept is important, as CA gives you the flexibility to set node groups that scale automatically according to your instructions while simultaneously excluding other node groups for manual scaling.
  2. CA adds or removes Kubernetes nodes following certain parameters that you configure. These parameters include the previously mentioned node groups, their minimum size, maximum size and more.
  3. CA runs as a Kubernetes deployment, in which secrets, services, namespaces, roles and role bindings are defined.

The supported versions of CA and Kubernetes may vary from one vendor to another. The way node groups are identified (using flags, labels, environmental variables, etc.) and the permissions needed for the deployment to run may also vary. However, at the end of the day, all implementations revolve around the principles listed previously: auto-scaling node groups, CA configuration parameters and CA deployment.

With that said, let’s get back to business. After pressing the Explore button, you should be directed to the Cluster Dashboard. For now, you’re only interested in looking at the nodes and the cluster’s capacity.

The next steps consist of defining node groups and carrying out the corresponding CA deployment. Start with the simplest and follow some best practices to create a namespace to deploy the components that make CA. To do this, go to Projects/Namespaces:

Create a new namespace

On the next screen, you can manage Rancher Projects and namespaces. Under Projects: System, click Create Namespace to create a new namespace part of the System project:

**Cluster Dashboard | Namespaces**

Give the namespace a name and select Create. Once the namespace is created, click on the icon shown here (ie import YAML):

Import YAML

One of the many advantages of Rancher is that it allows you to perform countless tasks from the UI. One such task is to import local YAML files or create them on the fly and deploy them to your Kubernetes cluster.

To take advantage of this useful feature, copy the following code. Remember to replace <PERSONAL_ACCESS_TOKEN> with the Linode token that you created for the tutorial:

---
apiVersion: v1
kind: Secret
metadata:
  name: cluster-autoscaler-cloud-config
  namespace: autoscaler
type: Opaque
stringData:
  cloud-config: |-
    [global]
    linode-token=<PERSONAL_ACCESS_TOKEN>
    lke-cluster-id=88612
    defaut-min-size-per-linode-type=1
    defaut-max-size-per-linode-type=5
    do-not-import-pool-id=88541

    [nodegroup "g6-standard-1"]
    min-size=1
    max-size=4

    [nodegroup "g6-standard-2"]
    min-size=1
    max-size=2

Next, select the namespace you just created, paste the code in Rancher and select Import:

Paste YAML

A pop-up window will appear, confirming that the resource has been created. Press Close to continue:

Confirmation

The secret you just created is how Linode implements the node group configuration that CA will use. This configuration defines several parameters, including the following:

  • linode-token: This is the same personal access token that you used to register LKE in Rancher.
  • lke-cluster-id: This is the unique identifier of the LKE cluster that you created with Rancher. You can get this value from the Linode console or by running the command curl -H "Authorization: Bearer $TOKEN" https://api.linode.com/v4/lke/clusters, where STOKEN is your Linode personal access token. In the output, the first field, id, is the identifier of the cluster.
  • defaut-min-size-per-linode-type: This is a global parameter that defines the minimum number of nodes in each node group.
  • defaut-max-size-per-linode-type: This is also a global parameter that sets a limit to the number of nodes that Cluster Autoscaler can add to each node group.
  • do-not-import-pool-id: On Linode, each node pool has a unique ID. This parameter is used to exclude specific node pools so that CA does not scale them.
  • nodegroup (min-size and max-size): This parameter sets the minimum and maximum limits for each node group. The CA for Linode implementation forces each node group to use the same node type. To get a list of available node types, you can run the command curl https://api.linode.com/v4/linode/types.

This tutorial defines two node groups, one using g6-standard-1 linodes (2GB nodes) and one using g6-standard-2 linodes (4GB nodes). For the first group, CA can increase the number of nodes up to a maximum of four, while for the second group, CA can only increase the number of nodes to two.

With the node group configuration ready, you can deploy CA to the respective namespace using Rancher. Paste the following code into Rancher (click on the import YAML icon as before):

---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    k8s-addon: cluster-autoscaler.addons.k8s.io
    k8s-app: cluster-autoscaler
  name: cluster-autoscaler
  namespace: autoscaler
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: cluster-autoscaler
  labels:
    k8s-addon: cluster-autoscaler.addons.k8s.io
    k8s-app: cluster-autoscaler
rules:
  - apiGroups: [""]
    resources: ["events", "endpoints"]
    verbs: ["create", "patch"]
  - apiGroups: [""]
    resources: ["pods/eviction"]
    verbs: ["create"]
  - apiGroups: [""]
    resources: ["pods/status"]
    verbs: ["update"]
  - apiGroups: [""]
    resources: ["endpoints"]
    resourceNames: ["cluster-autoscaler"]
    verbs: ["get", "update"]
  - apiGroups: [""]
    resources: ["nodes"]
    verbs: ["watch", "list", "get", "update"]
  - apiGroups: [""]
    resources:
      - "namespaces"
      - "pods"
      - "services"
      - "replicationcontrollers"
      - "persistentvolumeclaims"
      - "persistentvolumes"
    verbs: ["watch", "list", "get"]
  - apiGroups: ["extensions"]
    resources: ["replicasets", "daemonsets"]
    verbs: ["watch", "list", "get"]
  - apiGroups: ["policy"]
    resources: ["poddisruptionbudgets"]
    verbs: ["watch", "list"]
  - apiGroups: ["apps"]
    resources: ["statefulsets", "replicasets", "daemonsets"]
    verbs: ["watch", "list", "get"]
  - apiGroups: ["storage.k8s.io"]
    resources: ["storageclasses", "csinodes"]
    verbs: ["watch", "list", "get"]
  - apiGroups: ["batch", "extensions"]
    resources: ["jobs"]
    verbs: ["get", "list", "watch", "patch"]
  - apiGroups: ["coordination.k8s.io"]
    resources: ["leases"]
    verbs: ["create"]
  - apiGroups: ["coordination.k8s.io"]
    resourceNames: ["cluster-autoscaler"]
    resources: ["leases"]
    verbs: ["get", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: cluster-autoscaler
  namespace: autoscaler
  labels:
    k8s-addon: cluster-autoscaler.addons.k8s.io
    k8s-app: cluster-autoscaler
rules:
  - apiGroups: [""]
    resources: ["configmaps"]
    verbs: ["create","list","watch"]
  - apiGroups: [""]
    resources: ["configmaps"]
    resourceNames: ["cluster-autoscaler-status", "cluster-autoscaler-priority-expander"]
    verbs: ["delete", "get", "update", "watch"]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: cluster-autoscaler
  labels:
    k8s-addon: cluster-autoscaler.addons.k8s.io
    k8s-app: cluster-autoscaler
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-autoscaler
subjects:
  - kind: ServiceAccount
    name: cluster-autoscaler
    namespace: autoscaler

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: cluster-autoscaler
  namespace: autoscaler
  labels:
    k8s-addon: cluster-autoscaler.addons.k8s.io
    k8s-app: cluster-autoscaler
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: cluster-autoscaler
subjects:
  - kind: ServiceAccount
    name: cluster-autoscaler
    namespace: autoscaler

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cluster-autoscaler
  namespace: autoscaler
  labels:
    app: cluster-autoscaler
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cluster-autoscaler
  template:
    metadata:
      labels:
        app: cluster-autoscaler
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/port: '8085'
    spec:
      serviceAccountName: cluster-autoscaler
      containers:
        - image: k8s.gcr.io/autoscaling/cluster-autoscaler-amd64:v1.26.1
          name: cluster-autoscaler
          resources:
            limits:
              cpu: 100m
              memory: 300Mi
            requests:
              cpu: 100m
              memory: 300Mi
          command:
            - ./cluster-autoscaler
            - --v=2
            - --cloud-provider=linode
            - --cloud-config=/config/cloud-config
          volumeMounts:
            - name: ssl-certs
              mountPath: /etc/ssl/certs/ca-certificates.crt
              readOnly: true
            - name: cloud-config
              mountPath: /config
              readOnly: true
          imagePullPolicy: "Always"
      volumes:
        - name: ssl-certs
          hostPath:
            path: "/etc/ssl/certs/ca-certificates.crt"
        - name: cloud-config
          secret:
            secretName: cluster-autoscaler-cloud-config

In this code, you’re defining some labels; the namespace where you will deploy the CA; and the respective ClusterRole, Role, ClusterRoleBinding, RoleBinding, ServiceAccount and Cluster Autoscaler.

The difference between cloud providers is near the end of the file, at command. Several flags are specified here. The most relevant include the following:

  • Cluster Autoscaler version v.
  • cloud-provider; in this case, Linode.
  • cloud-config, which points to a file that uses the secret you just created in the previous step.

Again, a cloud provider that uses a minimum number of flags is intentionally chosen. For a complete list of available flags and options, read the Cloud Autoscaler FAQ.

Once you apply the deployment, a pop-up window will appear, listing the resources created:

CA deployment

You’ve just implemented CA on Kubernetes, and now, it’s time to test it.

CA in action

To check to see if CA works as expected, deploy the following dummy workload in the default namespace using Rancher:

Sample workload

Here’s a review of the code:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: busybox-workload
  labels:
    app: busybox
spec:
  replicas: 600
  strategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: busybox
  template:
    metadata:
      labels:
        app: busybox
    spec:
      containers:
      - name: busybox
        image: busybox
        imagePullPolicy: IfNotPresent
        
        command: ['sh', '-c', 'echo Demo Workload ; sleep 600']

As you can see, it’s a simple workload that generates 600 busybox replicas.

If you navigate to the Cluster Dashboard, you’ll notice that the initial capacity of the LKE cluster is 220 pods. This means CA should kick in and add nodes to cope with this demand:

**Cluster Dashboard**

If you now click on Nodes (side menu), you will see how the node-creation process unfolds:

Nodes

New nodes

If you wait a couple of minutes and go back to the Cluster Dashboard, you’ll notice that CA did its job because, now, the cluster is serving all 600 replicas:

Cluster at capacity

This proves that scaling up works. But you also need to test to see scaling down. Go to Workload (side menu) and click on the hamburger menu corresponding to busybox-workload. From the drop-down list, select Delete:

Deleting workload

A pop-up window will appear; confirm that you want to delete the deployment to continue:

Deleting workload pop-up

By deleting the deployment, the expected result is that CA starts removing nodes. Check this by going back to Nodes:

Scaling down

Keep in mind that by default, CA will start removing nodes after 10 minutes. Meanwhile, you will see taints on the Nodes screen indicating the nodes that are candidates for deletion. For more information about this behavior and how to modify it, read “Does CA respect GracefulTermination in scale-down?” in the Cluster Autoscaler FAQ.

After 10 minutes have elapsed, the LKE cluster will return to its original state with one 2GB node and one 4GB node:

Downscaling completed

Optionally, you can confirm the status of the cluster by returning to the Cluster Dashboard:

**Cluster Dashboard**

And now you have verified that Cluster Autoscaler can scale up and down nodes as required.

CA, Rancher and managed Kubernetes services

At this point, the power of Cluster Autoscaler is clear. It lets you automatically adjust the number of nodes in your cluster based on demand, minimizing the need for manual intervention.

Since Rancher fully supports the Kubernetes Cluster Autoscaler API, you can leverage this feature on major service providers like AKS, Google Kubernetes Engine (GKE) and Amazon Elastic Kubernetes Service (EKS). Let’s look at one more example to illustrate this point.

Create a new workload like the one shown here:

New workload

It’s the same code used previously, only in this case, with 1,000 busybox replicas instead of 600. After a few minutes, the cluster capacity will be exceeded. This is because the configuration you set specifies a maximum of four 2GB nodes (first node group) and two 4GB nodes (second node group); that is, six nodes in total:

**Cluster Dashboard**

Head over to the Linode Dashboard and manually add a new node pool:

**Linode Dashboard**

Add new node

The new node will be displayed along with the rest on Rancher’s Nodes screen:

**Nodes**

Better yet, since the new node has the same capacity as the first node group (2GB), it will be deleted by CA once the workload is reduced.

In other words, regardless of the underlying infrastructure, Rancher makes use of CA to know if nodes are created or destroyed dynamically due to load.

Overall, Rancher’s ability to support Cluster Autoscaler out of the box is good news; it reaffirms Rancher as the ideal Kubernetes multi-cluster management tool regardless of which cloud provider your organization uses. Add to that Rancher’s seamless integration with other tools and technologies like Longhorn and Harvester, and the result will be a convenient centralized dashboard to manage your entire hyper-converged infrastructure.

Conclusion

This tutorial introduced you to Kubernetes Cluster Autoscaler and how it differs from other types of autoscaling, such as Vertical Pod Autoscaler (VPA) and Horizontal Pod Autoscaler (HPA). In addition, you learned how to implement CA on Kubernetes and how it can scale up and down your cluster size.

Finally, you also got a brief glimpse of Rancher’s potential to manage Kubernetes clusters from the convenience of its intuitive UI. Rancher is part of the rich ecosystem of SUSE, the leading open Kubernetes management platform. To learn more about other solutions developed by SUSE, such as Edge 2.0 or NeuVector, visit their website.

Advanced Monitoring and Observability​ Tips for Kubernetes Deployments

Monday, 28 August, 2023

Cloud deployments and containerization let you provision infrastructure as needed, meaning your applications can grow in scope and complexity. The results can be impressive, but the ability to expand quickly and easily makes it harder to keep track of your system as it develops.

In this type of Kubernetes deployment, it’s essential to track your containers to understand what they’re doing. You need to not only monitor your system but also ensure your monitoring delivers meaningful observability. The numbers you track need to give you actionable insights into your applications.

In this article, you’ll learn why monitoring and observability matter and how you can best take advantage of them. That way, you can get all the information you need to maximize the performance of your deployments.

Why you need monitoring and observability in Kubernetes

Monitoring and observability are often confused but worth clarifying for the purposes of this discussion. Monitoring is the means by which you gain information about what your system is doing.

Observability is a more holistic term, indicating the overall capacity to view and understand what is happening within your systems. Logs, metrics and traces are core elements. Essentially, observability is the goal, and monitoring is the means.

Observability can include monitoring as well as logging, tracing, continuous integration and even chaos engineering. Focusing on each facet gets you as close as possible to full coverage. Correcting that can improve your observability if you’ve overlooked one of these areas.

In addition, using black boxes, such as third-party services, can limit observability by making monitoring harder. Increasing complexity can also add problems. Your metrics may not be consistent or relevant if collected from different services or regions.

You need to work to ensure the metrics you collect are taken in context and can be used to provide meaningful insights into where your systems are succeeding and failing.

At a higher level, there are several uses for monitoring and observability. Performance monitoring tells you whether your apps are delivering quickly and what resources they’re consuming.

Issue tracking is also important. Observability can be focused on specific tasks, letting you see how well they’re doing. This can be especially relevant when delivering a new feature or hunting a bug.

Improving your existing applications is also vital. Examining your metrics and looking for areas you can improve will help you stay competitive and minimize your costs. It can also prevent downtime if you identify and fix issues before they lead to performance drops or outages.

Best practices and tips for monitoring and observability in Kubernetes

With distributed applications, collecting data from all your various nodes and containers is more involved than with a standard server-based application. Your tools need to handle the additional complexity.

The following tips will help you build a system that turns information into the elusive observability that you need. All that data needs to be tracked, stored and consolidated. After that, you can use it to gain the insights you need to make better decisions for the future of your application.

Avoid vendor lock-in

The major Kubernetes management services, including Amazon Elastic Kubernetes Service (EKS)Azure Kubernetes Service (AKS) and Google Kubernetes Engine (GKE), provide their own monitoring tools. While these tools include useful features, you need to beware of becoming overdependent on any that belong to a particular platform, which can lead to vendor lock-in. Ideally, you should be able to change technologies and keep the majority of your metric-gathering system.

Rancher, a complete software stack, lets you consolidate information from other platforms that can help solve issues arising when companies use different technologies without integrating them seamlessly. It lets you capture data from a wealth of tools and pipe your logs and data to external management platforms, such as Grafana and Prometheus, meaning your monitoring isn’t tightly coupled to any other part of your infrastructure. This gives you the flexibility to swap parts of your system in and out without too much expense. With platform-agnostic monitoring tools, you can replace other parts of your system more easily.

Pick the right metrics

Collecting metrics sounds straightforward, but it requires careful implementation. Which metrics do you choose? In a Kubernetes deployment, you need to ensure all layers of your system are monitored. That includes the application, the control plane components and everything in between.

CPU and memory usage are important but can be tricky to use across complex deployments. Other metrics, such as API response, request and error rates, along with latency, can be easier to track and give a more accurate picture of how your apps are performing. High disk utilization is a key indicator of problems with your system and should always be monitored.

At the cluster level, you should track node availability and how many running pods you have and make sure you aren’t in danger of running out of nodes. Nodes can sometimes fail, leaving you short.

Within individual pods, as well as resource utilization, you should check application-specific metrics, such as active users or parts of your app that are in use. You also need to track the metrics Kubernetes provides to verify pod health and availability.

Centralize your logging

Diagram showing multiple Kubernetes clusters piping data to Rancher, which sends it to a centralized logging store, courtesy of James Konik

Kubernetes pods keep their own logs, but having logs in different places is hard to keep track of. In addition, if a pod crashes, you can lose them. To prevent the loss, make sure any logs or metrics you require for observability are stored in an independent, central repository.

Rancher can help with this by giving you a central management point for your containers. With logs in one place, you can view the data you need together. You can also make sure it is backed up if necessary.

In addition to piping logs from different clusters to the same place, Rancher can also help you centralize authorization and give you coordinated role-based access control (RBAC).

Transferring large volumes of data will have a performance impact, so you need to balance your requirements with cost. Critical information should be logged immediately, but other data can be transferred on a regular basis, perhaps using a queued operation or as a scheduled management task.

Enforce data correlation

Once you have feature-rich tools in place and, therefore, an impressive range of metrics to monitor and elaborate methods for viewing them, it’s easy to lose focus on the reason you’re collecting the data.

Ultimately, your goal is to improve the user experience. To do that, you need to make sure the metrics you collect give you an accurate, detailed picture of what the user is experiencing and correctly identify any problems they may be having.

Lean toward this in the metrics you pick and in those you prioritize. For example, you might want to track how many people who use your app are actually completing actions on it, such as sales or logins.

You can track these by monitoring task success rates as well as how long actions take to complete. If you see a drop in activity on a particular node, that can indicate a technical problem that your other metrics may not pick up.

You also need to think about your alerting systems and pick alerts that spot performance drops, preferably detecting issues before your customers.

With Kubernetes operating in a highly dynamic way, metrics in different pods may not directly correspond to one another. You need to contextualize different results and develop an understanding of how performance metrics correspond to the user’s experience and business outcomes.

Artificial intelligence (AI) driven observability tools can help with that, tracking millions of data points and determining whether changes are caused by the dynamic fluctuations that happen in massive, scaling deployments or whether they represent issues that need to be addressed.

If you understand the implications of your metrics and what they mean for users, then you’re best suited to optimize your approach.

Favor scalable observability solutions

As your user base grows, you need to deal with scaling issues. Traffic spikes, resource usage and latency all need to be kept under control. Kubernetes can handle some of that for you, but you need to make sure your monitoring systems are scalable as well.

Implementing observability is especially complex in Kubernetes because Kubernetes itself is complicated, especially in multi-cloud deployments. The complexity has been likened to an iceberg.

It gets more difficult when you have to consider problems that arise when you have multiple servers duplicating functionality around the world. You need to ensure high availability and make your database available everywhere. As your deployment scales up, so do these problems.

Rancher’s observability tools allow you to deploy new clusters and monitor them along with your existing clusters from the same location. You don’t need to work to keep up as you deploy more widely. That allows you to focus on what your metrics are telling you and lets you spend your time adding more value to your product.

Conclusion

Kubernetes enables complex deployments, but that means monitoring and observability aren’t as straightforward as they would otherwise be. You need to take special care to ensure your solutions give you an accurate picture of what your software is doing.

Taking care to pick the right metrics makes your monitoring more helpful. Avoiding vendor lock-in gives you the agility to change your setup as needed. Centralizing your metrics brings efficiency and helps you make critical big-picture decisions.

Enforcing data correlation helps keep your results relevant, and thinking about scalability ahead of time stops your system from breaking down when things change.

Rancher can help and makes managing Kubernetes clusters easier. It provides a vast range of Kubernetes monitoring and observability features, ensuring you know what’s going on throughout your deployments. Check it out and learn how it can help you grow. You can also take advantage of free, community training for Kubernetes & Rancher at the Rancher Academy.

Fleet: Multi-Cluster Deployment with the Help of External Secrets

Wednesday, 21 June, 2023

Fleet, also known as “Continuous Delivery” in Rancher, deploys application workloads across multiple clusters. However, most applications need configuration and credentials. In Kubernetes, we store confidential information in secrets. For Fleet’s deployments to work on downstream clusters, we need to create these secrets on the downstream clusters themselves.

When planning multi-cluster deployments, our users ask themselves: “I won’t embed confidential information in the Git repository for security reasons. However, managing the Kubernetes secrets manually does not scale as it is error prone and complicated. Can Fleet help me solve this problem?”

To ensure Fleet deployments work seamlessly on downstream clusters, we need a streamlined approach to create and manage these secrets across clusters.
A wide variety of tools exists for Kubernetes to manage secrets, e.g., the SOPS operator and the external secrets operator.

A previous blog post showed how to use the external-secrets operator (ESO) together with the AWS secret manager to create sealed secrets.

ESO supports a wide range of secret stores, from Vault to Google Cloud Secret Manager and Azure Key Vault. This article uses the Kubernetes secret store on the control plane cluster to create derivative secrets on a number of downstream clusters, which can be used when we deploy applications via Fleet. That way, we can manage secrets without any external dependency.

We will have to deploy the external secrets operator on each downstream cluster. We will use Fleet to deploy the operator, but each operator needs a secret store configuration. The configuration for that store could be deployed via Fleet, but as it contains credentials to the upstream cluster, we will create it manually on each cluster.
Diagram of ESO using a K8s namespace as a secret store
As a prerequisite, we need to gather the control plane’s API server URL and certificate.

Let us assume the API server is reachable on “YOUR-IP.sslip.io”, e.g., “192.168.1.10.sslip.io:6443”. You might need a firewall exclusion to reach that port from your host.

export API_SERVER=https://192.168.1.10.sslip.io:6443

Deploying the External Secrets Operator To All Clusters

Note: Instead of pulling secrets from the upstream cluster, an alternative setup would install ESO only once and use PushSecrets to write secrets to downstream clusters. That way we would only install one External Secrets Operator and give the upstream cluster access to each downstream cluster’s API server.

Since we don’t need a git repository for ESO, we’re installing it directly to the downstream Fleet clusters in the fleet-default namespace by creating a bundle.

Instead of creating the bundle manually, we convert the Helm chart with the Fleet CLI. Run these commands:

cat > targets.yaml <<EOF
targets:
- clusterSelector: {}
EOF

mkdir app
cat > app/fleet.yaml <<EOF
defaultNamespace: external-secrets
helm:
  repo: https://charts.external-secrets.io
  chart: external-secrets
EOF

fleet apply --compress --targets-file=targets.yaml -n fleet-default -o - external-secrets app > eso-bundle.yaml

Then we apply the bundle:

kubectl apply -f eso-bundle.yaml

Each downstream cluster now has one ESO installed.

Make sure you use a cluster selector in targets.yaml, that matches all clusters you want to deploy to.

Create a Namespace for the Secret Store

We will create a namespace that holds the secrets on the upstream cluster. We also need a service account with a role binding to access the secrets. We use the role from the ESO documentation.

kubectl create ns eso-data
kubectl apply -n eso-data -f - <<EOF
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: eso-store-role
rules:
- apiGroups: [""]
  resources:
  - secrets
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - authorization.k8s.io
  resources:
  - selfsubjectrulesreviews
  verbs:
  - create
EOF
kubectl create -n eso-data serviceaccount upstream-store
kubectl create -n eso-data rolebinding upstream-store --role=eso-store-role --serviceaccount=eso-data:upstream-store
token=$( kubectl create -n eso-data token upstream-store )

Add Credentials to the Downstream Clusters

We could use a Fleet bundle to distribute the secret to each downstream cluster, but we don’t want credentials outside of k8s secrets. So, we use kubectl on each cluster manually. The token was added to the shell’s environment variable so we don’t leak it in the host’s process list when we run:

for ctx in downstream1 downstream2 downstream3; do 
  kubectl --context "$ctx" create secret generic upstream-token --from-literal=token="$token"
done

Assuming we have the given kubectl contexts in our kubeconfig. You can check with kubectl config get-contexts.

Configure the External Secret Operators

We need to configure the ESOs to use the upstream cluster as a secret store. We will also provide the CA certificate to access the API server. We create another Fleet bundle and re-use the target.yaml from before.

mkdir cfg
ca=$( kubectl get cm -n eso-data kube-root-ca.crt -o go-template='{{index .data "ca.crt"}}' )
kubectl create cm --dry-run=client upstream-ca --from-literal=ca.crt="$ca" -oyaml > cfg/ca.yaml

cat > cfg/store.yaml <<EOF
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
  name: upstream-store
spec:
  provider:
    kubernetes:
      remoteNamespace: eso-data
      server:
        url: "$API_SERVER"
        caProvider:
          type: ConfigMap
          name: upstream-ca
          key: ca.crt
      auth:
        token:
          bearerToken:
            name: upstream-token
            key: token
EOF

fleet apply --compress --targets-file=targets.yaml -n fleet-default -o - external-secrets cfg > eso-cfg-bundle.yaml

Then we apply the bundle:

kubectl apply -f eso-cfg-bundle.yaml

Request a Secret from the Upstream Store

We create an example secret in the upstream cluster’s secret store namespace.

kubectl create secret -n eso-data generic database-credentials --from-literal username="admin" --from-literal password="$RANDOM"

On any of the downstream clusters, we create an ExternalSecret resource to copy from the store. This will instruct the External-Secret Operator to copy the referenced secret from the upstream cluster to the downstream cluster.

Note: We could have included the ExternalSecret resource in the cfg bundle.

kubectl apply -f - <<EOF
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: database-credentials
spec:
  refreshInterval: 1m
  secretStoreRef:
    kind: SecretStore
    name: upstream-store
  target:
    name: database-credentials
  data:
  - secretKey: username
    remoteRef:
      key: database-credentials
      property: username
  - secretKey: password
    remoteRef:
      key: database-credentials
      property: password
EOF

This should create a new secret in the default namespace. You can check the k8s event log for problems with kubectl get events.

 

We can now use the generated secrets to pass credentials as helm values into Fleet multi-cluster deployments, e.g., to use a database or an external service with our workloads.

Nowości produktowe SUSE ogłoszone na SUSECON’23

Wednesday, 21 June, 2023

Na konferencji SUSECON w Monachium, SUSE poinformowała o nowych, zaawansowanych rozwiązaniach open source, które pomogą klientom przyspieszyć transformację cyfrową w ramach misji jak najlepszego zabezpieczenia infrastruktury informatycznej i zwiększenia zaufania do technologii cyfrowych.

Nowy raport na temat trendów sponsorowany przez SUSE wykazał, że ponad 88% respondentów zgłosiło więcej niż jeden incydent bezpieczeństwa związany z chmurą w ciągu ostatniego roku. SUSE zajmuje się ochroną danych klientów i pomaga im zapobiegać zagrożeniom. Wychodząc naprzeciw obawom klientów, SUSE kontynuuje rozbudowę stosu zabezpieczeń infrastruktury IT, aby zapewnić klientom, partnerom i społecznościom open source możliwość bezpiecznego uruchamiania aplikacji bez względu na to, czy znajdują się one w chmurze, na brzegu sieci, czy w centrach danych, co zwiększa z kolei niezawodność prowadzonych przez nich działalności. 

successful BCL Launch

Nowy poziom bezpieczeństwa Linuksa dla rozwiązań działających natywnie w chmurze

Najnowsza wersja flagowej platformy linuksowej SUSE dla przedsiębiorstw, SUSE Linux Enterprise 15 Service Pack 5 (SLE 15 SP5), została zaprojektowana z myślą o zapewnieniu wysokiej wydajności obliczeniowej, która jest niezbędna do obsługi obciążeń AI/ML, i współpracuje z systemem Rancher, najbardziej rozpowszechnioną na świecie platformą do zarządzania Kubernetesem. SLE 15 SP5 ponadto rozszerza możliwości oprogramowania SUSE Live Patching poprawiając ciągłość biznesową klientów, bezpieczeństwo i zgodność, a także jeszcze bardziej wzmacnia reputację SLE jako najbezpieczniejszej platformy linuksowej w branży z najwyższym poziomem certyfikatów branżowych. Najważniejsze nowości:

  • Wprowadzenie ochrony danych do środowisk chmurowych i brzegowych dzięki Confidential Computing – SLE 15 SP5 to pierwsza dystrybucja Linuksa obsługująca całe spektrum funkcji Confidential Computing, rewolucyjnego podejścia do zabezpieczania danych przetwarzanych w chmurze publicznej i na brzegu sieci. Umożliwia ona uruchamianie w pełni zaszyfrowanych maszyn wirtualnych bez względu na środowisko i wykorzystywane w nim architektury. Tu należy dodać, że SLES 15 SP5 obsługuje najnowsze innowacje chipsetów firm AMD, Arm, IBM i Intel.
  • Zabezpieczanie infrastruktury SAP – oprogramowanie SLE 15 SP5 for SAP Applications – zatwierdzone przez SAP – jeszcze bardziej poprawia wysoką dostępność systemów SAP i szybsze ich wdrażanie dzięki ulepszonej automatyzacji i narzędziom z wbudowanymi funkcjami bezpieczeństwa. Ulepszenia te obejmują: automatyczne wykrywanie i pełną obserwowalność serwerów, instancji chmurowych, baz danych SAP HANA, SAP S/4HANA, aplikacji NetWeaver i klastrów. Najnowsze ulepszenia w SP5 zapewniają ciągłe sprawdzanie konfiguracji wysokiej dostępności (HA) z wizualizacją potencjalnych problemów i zastosowaniem zalecanych poprawek.
  • Wzmacnianie niezawodności wszystkich posiadanych systemów Linux – SUSE Manager 4.3.6 obsługuje teraz ponad 15 różnych dystrybucji Linuksa, w tym systemy SUSE, a także wszystkie odmiany RHEL 9, takie jak Rocky Linux, Alma Linux i RHEL 9. Wczesną jesienią SUSE Manager będzie dostępny jako płatna oferta na rynku AWS. Pozwoli to klientom zarządzać infrastrukturą z poziomu chmury, korzystając z możliwości pomiaru zużycia, skalowalności i pojedynczych rozliczeń z dostawcą chmury. W przypadku braku czasu i umiejętności własnych klienci mogą skorzystać z nowych ofert na SUSE Managera, w tym jednej przeznaczonej specjalnie dla klientów korzystających z obciążeń SAP, które obejmują subskrypcje na to oprogramowanie, usługi i szkolenia SUSE.
  • Linux dla środowisk chmurowych – platforma SUSE Adaptable Linux Platform (ALP) wprowadza system Linux klasy korporacyjnej do nowoczesnych środowisk chmurowych, ewoluując w kierunku modułowego systemu Linux obsługującego skonteneryzowane i zwirtualizowane obciążenia. SUSE ALP to projekt open source, który zapewnia samonaprawianie i samozarządzanie, wykonując zadania wpływające zarówno na system operacyjny, jak i warstwę kontenerów. Dzięki temu użytkownicy mogą skupić się na swoich zadaniach, jednocześnie nie przejmując się sprzętem i aplikacjami.

Zabezpieczenie cyfrowych przedsiębiorstw poprzez zarządzanie pełnym cyklem życia kontenerów obsługiwanych przez Kubernetes 

Raport SUSE wykazał również, że 88% respondentów było zgodnych co do tego, że ich zespoły zmniejszyłyby liczbę obciążeń w chmurze i na brzegu sieci, gdyby wiedziały, że ich dane mogą tam zostać naruszone. Aby zapewnić ochronę klientom i partnerom, Rancher by SUSE opiera się na wprowadzonych wiosną 2023 r. nowych aktualizacjach produktu skoncentrowanych na bezpieczeństwie, które obejmują zoptymalizowaną pamięć masową, obsługę utwardzonych maszyn wirtualnych oraz ulepszone zarządzanie podatnościami i zgodnością.

  • Zwiększenie ochrony danych, optymalizacja archiwów kopii zapasowych i nowe standardy pamięci masowej zoptymalizowanej pod kątem Kubernetesa dzięki zaawansowanej technologii jądra. Longhorn 1.5, projekt inkubatora CNCF, którego Rancher jest głównym opiekunem, będzie zawierał wersję podglądową silnika pamięci masowej nowej generacji opartego na Storage Performance Development Kit, aby poprawić wydajność operacji wejścia-wyjścia dla trwałych woluminów używanych przez aplikacje. Inne nowo wydane funkcje obejmują możliwość kontrolowania obrazów kopii zapasowych za pośrednictwem interfejsu pamięci masowej kontenera (CSI) oraz obsługę ClusterAutoscaler za pośrednictwem Pod Disruption Budgets. Zapewnia to operatorom większą kontrolę nad kosztami wolumenów pamięci masowej i wsparcie wdrażania Kubernetesa w chmurze publicznej.
  • Rozwiązanie dla rosnącej współzależności kontenerów i maszyn wirtualnych w nowoczesnych środowiskach infrastrukturalnych. SUSE kontynuuje postępy w upraszczaniu operacji infrastrukturalnych w chmurze dzięki nadchodzącej wersji Harvester 1.2. Począwszy od lipca, użytkownicy uzyskają dostęp do nowych funkcji, w tym obsługi pamięci masowej innych firm za pośrednictwem CSI oraz możliwości uruchamiania systemów operacyjnych zoptymalizowanych pod kątem bezpieczeństwa. Użytkownicy rozwiązań dla Telco i Edge skorzystają również z nowych dynamicznych alokacji funkcji wirtualizacji pojedynczego źródła I/O w różnych obciążeniach i będą mogli wdrożyć nową, modułową strukturę, która zapewnia lepszą kontrolę funkcji operacyjnych w środowiskach o ograniczonych zasobach.

    Ponadto nowe funkcje eksperymentalne obejmują: implementację pełnej konsoli zarządzania Ranchera wbudowanej teraz w Harvester w celu szybszego wdrożenia Ranchera, a także wydanie „trybu bare metal” w Harvesterze, które ma na celu umożliwienie użytkownikom uruchamiania i zarządzania maszynami wirtualnymi i kontenerami w klastrach Kubernetesa.

  • Usprawnienie zarządzania podatnościami i uproszczenie zabezpieczania Kubernetesa. Nowa wersja SUSE NeuVector 5.2 zapewnia bezpieczeństwo klasy korporacyjnej, zarządzanie podatnościami i zgodnością, a także skalowalność i niezawodność. Główne funkcje obejmują wyszukiwanie wspólnych podatności i ekspozycje bazy danych, mapowanie raportów NIST 800-53, które zapewnia, że nic ważnego nie zostanie przeoczone, testy porównawcze Center for Internet Security (CIS), zintegrowane rozliczenia w ramach AWS Marketplace, dostęp do API oparty na tokenach, konfigurowalne okna logowania (RGS) i adapter Harbor.

    SUSE kontynuuje inwestycje we współpracę z dostawcami usług w chmurze w ramach całej swojej działalności. W lipcu SUSE NeuVector będzie dostępny na AWS Marketplace, dając klientom AWS samoobsługowy dostęp do kompleksowych zabezpieczeń kontenerów o zerowym poziomie zaufania w modelu pay-as-you-go. NeuVector zapewnia niezrównany wgląd w infrastrukturę Kubernetesa, kontrolę opartą na zerowym zaufaniu w celu zapobiegania atakom w czasie rzeczywistym oraz bezpieczeństwo łańcucha dostaw dzięki skanowaniu podatności i kontroli zgodności oraz tworzeniu polityki bezpieczeństwa jako kodu. Ponadto jeszcze tego lata rozwiązanie SUSE NeuVector będzie dostępne na platformach Azure i Google Cloud.

  • Poprawa doświadczeń klientów dzięki sztucznej inteligencji. Asystent AI Rancher Prime zapewni klientom zautomatyzowaną, dokładną pomoc w czasie rzeczywistym i będzie wkrótce dostępny za pośrednictwem kanału Slack dla klientów Rancher Prime. Wykorzystując moc OpenAI i innych najnowocześniejszych technologii generatywnej sztucznej inteligencji, Rancher będzie w stanie zapewnić samoobsługowe, łatwe w użyciu środowisko użytkownika, zapewniając jednocześnie dokładne i pomocne informacje.

Poprawa funkcjonalności i bezpieczeństwa środowisk rozproszonych

Rozwiązanie SUSE Edge uzyskało dodatkowe wsparcie dzięki włączeniu do niego Akri jako komponentu SUSE Edge do wykrywania i planowania obciążeń dla urządzeń Internetu rzeczy (IoT), w tym czujników, systemów sterowania, kamer i innych. Pozwala to na deklaratywne zarządzanie przemysłowymi urządzeniami IoT wraz z resztą stosu. Usprawniono w ten sposób integrację IT z OT i zapewniono możliwość ponownego wykorzystania konfiguracji, a także stworzenia samonaprawiającego się klastra.

Więcej informacji o tym, jak SUSE pomaga swoim klientom budować cyfrowe zaufanie, można znaleźć na stronie www.suse.com/digital-trust, a najnowsze informacje o produktach SUSE można uzyskać rejestrując się na konferencję SUSECON Digital: www.suse.com/susecon.

Demystifying Container Orchestration: A Beginner’s Guide

Thursday, 20 April, 2023

Introduction

As organizations increasingly adopt containerized applications, it is essential to understand what container orchestration is. This guide delves into what container orchestration is, its benefits, and how it works, comparing popular platforms like Kubernetes and Docker. We will also discuss multi-cloud container orchestration and the role of Rancher Prime in simplifying container orchestration management.

What is Container Orchestration?

Container orchestration is the process of managing the lifecycle of containers within a distributed environment. Containers are lightweight, portable, and scalable units for packaging and deploying applications, providing a consistent environment, and reducing the complexity of managing dependencies. Container orchestration automates the deployment, scaling, and management of these containers, ensuring the efficient use of resources, improving reliability, and facilitating seamless updates.

How Does Container Orchestration Work?

Container orchestration works by coordinating container deployment across multiple host machines or clusters. Orchestration platforms utilize a set of rules and policies to manage container lifecycles, which include:

  • Scheduling: Allocating containers to available host resources based on predefined constraints and priorities.
  • Service discovery: Identifying and connecting containers to form a cohesive application.
  • Load balancing: Distributing network traffic evenly among containers to optimize resource usage and improve application performance.
  • Scaling: Dynamically adjusting the number of container instances based on application demand.
  • Health monitoring: Monitoring container performance and replacing failed containers with new ones.
  • Configuration management: Ensuring consistent configuration across all containers in the application.
  • Networking: Managing the communication between containers and external networks.

Why Do You Need Container Orchestration?

Container orchestration is essential for organizations that deploy and manage applications in a containerized environment. It addresses the challenges that arise when managing multiple containers, such as:

  • Scaling applications efficiently to handle increased workloads.
  • Ensuring high availability and fault tolerance by detecting and replacing failed containers.
  • Facilitating seamless updates and rollbacks.
  • Managing and maintaining container configurations.
  • Optimizing resource usage and application performance.

What are The Benefits of Container Orchestration?

Container orchestration offers several advantages, including:

  • Improved efficiency: Container orchestration optimizes resource usage, reducing infrastructure costs.
  • Enhanced reliability: By monitoring container health and automatically replacing failed containers, orchestration ensures application availability and fault tolerance.
  • Simplified management: Orchestration automates container deployment, scaling, and management, reducing the manual effort required.
  • Consistency: Orchestration platforms maintain consistent configurations across all containers, eliminating the risk of configuration drift.
  • Faster deployment: Orchestration streamlines application deployment, enabling organizations to bring new features and updates to market more quickly.

What is Kubernetes Container Orchestration?

Kubernetes is an open-source container orchestration platform developed by Google. It automates the deployment, scaling, and management of containerized applications. Kubernetes organizes containers into groups called “pods” and manages them using a declarative approach, where users define the desired state of the application, and Kubernetes works to maintain that state. Key components of Kubernetes include:

  • API server: The central management point for Kubernetes, providing a RESTful API for communication with the system.
  • etcd: A distributed key-value store that stores the configuration data for the Kubernetes cluster.
  • kubelet: An agent that runs on each worker node, ensuring containers are running as defined in the desired state.
  • kubectl: A command-line tool for interacting with the Kubernetes API server.

What is Multi-Cloud Container Orchestration?

Multi-cloud container orchestration is the management of containerized applications across multiple cloud providers. Organizations often use multiple clouds to avoid vendor lock-in, increase application resilience and leverage specific cloud services or features. Multi-cloud orchestration enables organizations to:

  • Deploy applications consistently across different cloud providers.
  • Optimize resource usage and cost by allocating containers to the most suitable cloud environment.
  • Enhance application resilience and availability by distributing workloads across multiple clouds.
  • Simplify management and governance of containerized applications in a multi-cloud environment.

Docker Container Orchestration vs. Kubernetes Container Orchestration

Docker and Kubernetes are both popular container orchestration platforms, each with its strengths and weaknesses.

Docker:

  • Developed by Docker Inc., the same company behind the Docker container runtime.
  • Docker Swarm is the native container orchestration tool for Docker.
  • Easier to set up and manage, making it suitable for small-scale deployments.
  • Limited scalability compared to Kubernetes.
  • Lacks advanced features like auto-scaling and rolling updates.

Kubernetes:

  • Developed by Google and now owned by the CNCF, with a large community and ecosystem.
  • More feature-rich, including auto-scaling, rolling updates, and self-healing.
  • Higher complexity, with a steeper learning curve than Docker Swarm.
  • Highly scalable, making it suitable for large-scale deployments and enterprises.
  • Widely adopted and supported by major cloud providers.

Container Orchestration Platforms

Several container orchestration platforms are available, including:

  • Kubernetes: An open-source, feature-rich, and widely adopted enterprise container orchestration platform.
  • Docker Swarm: Docker’s native container orchestration tool, suitable for small-scale deployments.
  • Amazon ECS (Elastic Container Service): A managed container orchestration service provided by AWS.
  • HashiCorp Nomad: A simple scheduler and orchestrator to deploy and manage containers and non-containerized applications across on-prem and clouds at scale.

Considerations When Implementing Container Orchestration

Before implementing container orchestration, organizations should consider the following factors:

  • Scalability: Choose an orchestration platform that can handle the anticipated workload and scale as needed.
  • Complexity: Assess the learning curve and complexity of the orchestration platform, ensuring it aligns with the team’s expertise.
  • Integration: Ensure the orchestration platform integrates well with existing tools, services, and infrastructure.
  • Vendor lock-in: Evaluate the potential for vendor lock-in and consider toolsets that support multi-cloud strategies to mitigate this risk.
  • Support and community: Assess both enterprise support and community resources available for the chosen orchestration platform.
  • Sustainability: Ensure the long-term sustainability of your chosen platform.
  • Security: integrate proven security frameworks like Secure Software Supply Chain and Zero Trust early in the platform design process.

How Rancher Prime Can Help

Rancher Prime is an open-source container management platform that simplifies Kubernetes management and deployment. Rancher Prime provides a user-friendly interface for securely managing container orchestration across multiple clusters and cloud providers. Key features of Rancher Prime include:

  • Centralized management: Manage multiple Kubernetes clusters from a single dashboard.
  • Multi-cloud support: Deploy and manage Kubernetes clusters on various cloud providers and on-premises environments.
  • Integrated tooling: Rancher Prime integrates with popular tools for logging, monitoring, and continuous integration/continuous delivery (CI/CD).
  • Security: Rancher Prime provides built-in security features, including FIPS encryption, STIG certification, a centralized authentication proxy, role-based access control, pod security admission, network policies, enhanced policy management engine, …
  • Enhanced security: when Rancher Prime is combined with container native security by SUSE NeuVector, you can fully implement Zero Trust for enterprise grade container orchestration hardening.
  • Simplified cluster operations: Rancher Prime simplifies cluster deployment, scaling, and upgrades, either through and easy to learn API or by leveraging industry standards like Cluster API.
  • Support and community: Since 1992 SUSE provide specialized enterprise support and it works closely with organizations like CNCF to provide community validated solutions. SUSE owns the Rancher Prime product suite and is an active contributor to the CNCF having donated projects like: K3s, Longhorn and Kubewarden.

Conclusion

Container orchestration is a critical component for managing containerized applications in a distributed environment. Understanding the differences between platforms like Kubernetes and Docker, as well as the benefits of multi-cloud orchestration, can help organizations make informed decisions about their container orchestration strategy. Rancher Prime offers a powerful solution for simplifying the management and deployment of container orchestration in any scenario, making it easier for organizations to reap the benefits of containerization.