<?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 Mark Borowski on Medium]]></title>
        <description><![CDATA[Stories by Mark Borowski on Medium]]></description>
        <link>https://medium.com/@mlrborowski?source=rss-67b5922ebc74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Gyn9zNpSVttCaoMq</url>
            <title>Stories by Mark Borowski on Medium</title>
            <link>https://medium.com/@mlrborowski?source=rss-67b5922ebc74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 21:44:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mlrborowski/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[Managing Kubernetes at Scale — Growing a Small Fleet to a Navy]]></title>
            <link>https://medium.com/@mlrborowski/managing-kubernetes-at-scale-growing-a-small-fleet-to-a-navy-222e2dc8cbbd?source=rss-67b5922ebc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/222e2dc8cbbd</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[multi-cloud-security]]></category>
            <category><![CDATA[multi-cloud]]></category>
            <category><![CDATA[multi-cloud-management]]></category>
            <dc:creator><![CDATA[Mark Borowski]]></dc:creator>
            <pubDate>Wed, 04 Sep 2019 19:24:55 GMT</pubDate>
            <atom:updated>2019-09-04T19:24:55.965Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Managing Kubernetes at Scale — Growing a Small Fleet to a Navy</strong></h3><p>Kubernetes has exploded in popularity in recent year and for good reason. Most of us cannot recall a time when developers have been so empowered and autonomous, able to provision applications and infrastructure at will via Kubernetes’ rich and extensible API. As with any burgeoning technology there is a burst of excitement that is tempered by the reality of managing the shiny new offering in production and at scale. In keeping with the nautical theme of Kubernetes the aim of this article is to introduce best practices for scaling Kubernetes beyond a small fleet e.g. a few clusters to a Navy which implies hardened and secured industrial scale.</p><p><strong>Many ships in the sea — Patterns of Cluster Growth</strong></p><p>Like the early days of virtualized infrastructure, where virtual machines and hypervisor counts grew quickly, now we see similar Docker container and Kubernetes cluster count growth. Organizations scaling up Kubernetes cluster counts are doing so via several ad hoc patterns described below and primarily classified as Organizationally Driven and/or Architecturally driven.</p><p><em>Organizationally-based Cluster Scale Out</em></p><p>As with all good software (and arguably operations management) innovation, it all starts with the developers. Development teams often start by sharing a single Kubernetes Cluster and carving that up into namespaces/projects (if using OpenShift). Namespaces/projects give development teams a way to avoid stepping on one another by controlling access to each namespace (separation of concerns) and additionally controlling resource limits. Kubernetes based Software Defined Networks (SDNs) like Calico or Open Virtual Switch allow control over how different namespaces can access one another’s resources and route message between them or forbid routing.</p><p>Many development teams have grown comfortable developing on Kubernetes and so to have operations teams deploying and managing the clusters. Organizations with mature deployment automation skill start to treat whole clusters like ephemeral resources e.g. just like lower level Kubernetes constructs that come and go (like pods and services). A common pattern (pictured below in Figure 1) is for Line of Business (LoB) development teams to have a Kubernetes cluster provisioned for them to use in isolation. Often these clusters are provisioned by a central IT organization that has expertise in the IaaS layer beneath, as well as, the hooks required for centralized monitoring of the clusters. The benefits of a centralized cluster deployment automation and management foundation that serves multiple LoB development teams are many. Key benefits of centralized cluster administration include standardized automation tooling, predefined cluster patterns (appropriate T Shirt sizes) and standards enforcement for services like authorization, logging, and monitoring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*-AqPRX8LjbHTMk-4NepF2w.png" /><figcaption>Figure 1 — Line of Business-Driven Cluster Scale Out</figcaption></figure><p><em>Architecture-driven Cluster Scale Out</em></p><p>A major factor that dictates Kubernetes cluster organization, size and count is the DevOps architecture or more specifically the number of promotion stages. A typical application promotion lifecycle has at least four stages which we will roughly represented as Development (with unit test), Test (integration testing), QA (quality assurance/acceptances testing) and Production. Early adopters often tried to put all of these stages in a single cluster with a namespace for each stage (save production which often needed colocation with its historical location). An inherent benefit of the “promote by namespace” approach is that cluster density can be maximized by sharing stages in a single cluster. Recall that most high availability clusters can require up to five nodes (~20 vCPUs) just for the management plane (masters nodes, etcd nodes, etc.). With a single cluster we can spread the management resource overhead across at least three namespaces (Development, Test, QA). Another advantage of a single cluster is the ease by which promotions can be managed with in-cluster CICD tooling (ex. Jenkins) which is often directly integrated into a common cluster-wide process using something like a Jenkinsfile to define stages. While a shared cluster across promotion stages might be the most efficient use of resources, high security and compliance focused organizations often choose to isolate promotion stages in their own clusters. In this high security environment developers would never have credentials to access the production cluster. The two common DevOps-driven cluster promotion architectures (namespaces v. cluster per stage) are shown below in Figure 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*exfyI_omxMVFyP_7Y6K0ag.png" /><figcaption>Figure 2 — Cluster Architecture by DevOps Promotion Style</figcaption></figure><p>Counter to the shared cluster philosophy is one driven by the desire for isolation. LoB development teams often want isolation from others to avoid perceived “noisy neighbor” problems or even accounting charge back visibility. A LoB may additionally may want to independently choose the cloud landing zone to which their cluster get provisioned based on workload affinities, skills or pricing.</p><p>As application architectures grow in size, slices of the architecture such as application domains or shared middleware platforms are considered by some as candidates for their own clusters. A related consideration are cluster upgrades such as Kubernetes version changes and if this can be done in the same active cluster. A better option may be to provision a new “latest version” Kubernetes cluster and then deploy to it. Kubernetes with its horizontal autoscalers and load balanced services are inherently locally HA but not necessarily Disaster Recovery (DR) enabled. DR is essentially built in for a cluster that is deployed across and built to leverage multiple zones of a public cloud region. Likewise, this can be done on premise but rarely do on-premise private clouds have three geographically separated regions with low latency connections. In the case where DR is not “built in” extra clusters are deployed to mirror the live cluster should fail over occur. The DR mirror cluster case is an architectural decision that will commonly drive cluster count growth.</p><p><strong>Tracking Every Ship in the Fleet — Managing Multi-cluster Inventory</strong></p><p>Regardless of which organizational or architectural choice has led to the sprawl of Kubernetes clusters one common need appears, that of a centralized multi-cluster management capability. Back to our nautical analogy, as we have grown from a small fleet to a Navy we need a Radar and Communication systems to track and manage our global fleet. Similarly, with all our Kubernetes cluster we need a common solution to manage cluster inventory, health status, and security compliance at a minimum.</p><p>Managing Multiple Clusters starts with managing Applications not resources. Along with multiple clusters arises the need to manage deployment decisions based on the workload, the cluster type and cluster parameters. Just as we might have chosen a node inside a cluster based on the resource requirements needed to run our pods, similar decision need to be made for large application and the clusters on which they should run. Kubernetes is described (by its home page, <a href="https://kubernetes.io/)">https://kubernetes.io/)</a> as “an open-source system for automating deployment, scaling, and management of containerized applications” yet to date an Application has just been an independent list of Kubernetes resource definitions.</p><p>To support this notion of informed and potentially automated cluster workload placement the concept of the Kubernetes Application definition has been created. Enter the Kubernetes Application (<a href="https://github.com/kubernetes-sigs/application">https://github.com/kubernetes-sigs/application</a>) which is a Custom Resource Definition (CRD) and controller that is meant to express an arbitrarily complex application that can be defined with interdependent parts and policies to guide its placement. The Application concept is meant to fill a formal definition gap above a simple Kubernetes resource definition which only effectively lives within a single cluster boundary. A Kubernetes Application can contain others. It can have a repositories describing where its components, known as Deployables are sources from. It can be tied to a Placement Policy resources which leverages traditional Kubernetes tagging concepts to describe what capabilities are required of potential target clusters.</p><p>The Application concept is supported by other new Kubernetes resource that help support it. The diagram below (Figure 3) describes the schema of the new resources supporting the Application concept (UML like classes are used to show resource relationships with attributes and purpose description in lieu of UML methods).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*fjFljQS5sXsHkDhoBpMahw.png" /><figcaption>Figure 3 — Application CRD Concepts Enabling Multi-Cluster Deployment Automation</figcaption></figure><p>The Application Resource groups together other resources into a set by application label. This set can now be used to create, delete and even monitor the set as a whole. A custom Grafana dashboard can easily be set up to monitor health events for the application as a whole based on the resource set defined in the Application resource.</p><p>The Application Relationship resources enable us to group together a set of Deployable resources (think Helm Chart locations and versions), as well as a set of rules for which clusters to deploy them to and how many Deployable replicas to create. The deployment rules are defined using Placement Policy resources. A Placement Policy primarily defines the required matching labels expected of the target cluster (and yes, the cluster itself is a resource with labels). Each Deployable can be bound to a Placement Policy. As an example, a DevOps team may want to label a cluster with a “stage” label with either a “development” or “production” tag value. Only Deployables that have been tested and approved could be deployed to a “production” cluster using this mechanism.</p><p><strong>Securing every Ship in the fleet — Managing Multi-Cluster compliance and security</strong></p><p>It is not enough to know that our clusters are healthy and running the appropriate workload on the appropriate cluster. We need to know that they are secure and following a prescribed policy that might limit user permissions or access to parts of the cluster or even Kubernetes resource access. As you may have guessed, there are newly introduced resource definitions meant to address these cluster compliance concerns. The Compliance and Policy resources (realized as CRDs and controllers) are design to address our multi-cluster compliance needs. The design of the Compliance and Policy resources are similar to how roles and role bindings work in Kubernetes where rules govern which Kubernetes’ resources are accessible and how they can be accessed. Policies are contained in Compliances and within Policies are the rules which are more formally called Templates. A Template can be of three different types. They can be Role-templates which means they specify RBAC roles that might be required and how they should be implemented. An example of a Role-template is one that might check that a role named “administrator” exists (and create if not) and that it has full read/write access to the RBAC Kubernetes API so other users and groups can be configured. A second template type is an Object-template which specifies a named set of Kubernetes objects that should exists and how they are configured. An Object-template might specify a limit range or a pod security policy that is required in a specific cluster. The last template type is a Policy-template which we won’t go into other than to say it provides a mechanism to extend policy checking to third parties.</p><p>The Compliance resource and those related to it are described below (in Figure 4 where UML like classes are used to show resource relationships with attributes and purpose description in lieu of UML methods).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*EajiTmrODK67Vq9zw6gdMA.png" /><figcaption>Figure 4 — Compliance and Policy CRDs Enabling Cluster Policy Enforcement</figcaption></figure><p>The key to making Compliances actionable is to apply them to a set of clusters we would like to evaluate for policy violations. Earlier we discussed how Deployables were tied to target clusters with a Placement Policy and a Placement Binding. We reuse that concept when choosing clusters to target for compliances checks. As shown above, a Compliance with its Policies and Templates are targeted against a set of clusters defined in a Placement Policy. The Placement Binding allows us to reuse compliance definitions (what rules to check) and Placement Policy (what clusters to check) such that we can map them to each other at will. If we look back at the Template definition we see that we can check for missing roles and objects, as well as, checking for ones that should not exist. The Policy definition lets us define what remediation action to take on a violation. In a Policy we can define whether we inform or enforce a violation. Inform means we just report a violation. Enforce means that an action will be taken to make the cluster compliant by potentially adding missing roles or objects</p><p><strong>The IBM Multi-cluster Manager — An Example Implementation</strong></p><p>We have spent most of this article relating the challenges of scaling Kubernetes to large cluster counts along with the emerging conceptual standards to address. The good news is that the theory has been proven with a live implementation. IBM has created its Multi-cluster Manager (MCM) to realize the promise of the specifications around Applications, Deployables, Compliances, Policies and more. IBM MCM has the ability to manage clusters distributed across virtually any cloud. Below (Figure 5) we see MCM’s cluster inventory including clusters from AWS (EKS), Azure (AKS), IBM Cloud (IKS) and local on-premise RedHat Openshift clusters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*MCVTNpkpQmG24ysJd73dEg.png" /><figcaption>Figure 5 — IBM MCM Cluster Overview Screen</figcaption></figure><p>IBM MCM is Application-aware with the ability to deploy all the Application components and bindings per the specifications that we described earlier. Drilling into a deployed application in MCM one is presented with the live graphical view of all the components of that application as shown below (Figure 6). One can drill into a Deployment (show as leaf nodes below with a gear icon) to see the live logs of the deployed pods or even see a custom federated Grafana dashboard showing event of all component parts of the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*Hzr0ddLF0NRO9dgPECmmcg.png" /><figcaption>Figure 6 — IBM MCM Live Application Deployment Diagram</figcaption></figure><p>IBM MCM has fully implemented the Compliance and Policy concepts as CRDs and controllers in the hub (managed from) and spoke cluster (managed to) in which they run. Below is a screen shot (Figure 7) of IBM MCM showing which clusters are non-compliant with the policy specification. Additionally, policies definitions and MCM reporting are expressive enough to show whether a cluster in compliant with an industry standard like PCI or HIPAA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*02s9f6xzXsucK4Wu9aOhLw.png" /><figcaption>Figure 7 — IBM MCM Live Cluster Policy Compliance Report</figcaption></figure><p><strong>Summary</strong></p><p>For those attempting to deploy Kubernetes clusters at scale, there are challenges but many are being addressed through Kubernetes resource extensions, best practices and emerging Multi-cluster management hubs. Understanding patterns of cluster growth, whether driven by organization boundaries or architectural constructs, will help Kubernetes DevOps team plan for and manage cluster growth through automation and enforceable policy standards. The new extended resources of Kubernetes Applications, Deployables and Placement Policies have provided a framework for multi-cluster workload planning and deployment automation and control. We also introduced the extended Kubernetes resource concepts of Compliances and Policies that enable automated verification and corrective remediation. This mechanism allows us to ensure standards compliance even with large scale cluster counts. Lastly, we discussed the proof point of the IBM Multi-cluster manager where the related multi-cluster specifications have been implemented to manage multiple diverse clusters at scale. Hopefully you have seen that large-scale multi-cluster management is a manageable challenge and your small fleet of ships (clusters) can truly grow to a formidable Navy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=222e2dc8cbbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Ark and Restic to provide DR for IBM Kubernetes Service]]></title>
            <link>https://medium.com/@mlrborowski/using-ark-and-restic-to-provide-dr-for-ibm-kubernetes-service-cae53cfe532?source=rss-67b5922ebc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/cae53cfe532</guid>
            <category><![CDATA[ibm]]></category>
            <category><![CDATA[ark]]></category>
            <category><![CDATA[cloud-storage]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Mark Borowski]]></dc:creator>
            <pubDate>Tue, 20 Nov 2018 20:54:28 GMT</pubDate>
            <atom:updated>2018-11-20T20:54:28.353Z</atom:updated>
            <content:encoded><![CDATA[<h4>Restore your application configurations AND your persistent storage.</h4><h4>Overview</h4><p>Skill Level: Beginner to Intermediate<br>Basic understanding of Kubernetes is required.</p><p>We will use:</p><ul><li>IBM Cloud Object Storage</li><li>IBM Kubernetes Service (IKS)</li><li>Heptio Ark with Restic Plugin</li><li>IBM Cloud Private (for advanced Use Case)</li></ul><p>Heptio Ark provides an automated object storage-based back up and restore capability for Kubernetes (K8S) cluster configurations. Ark has additional plugins that allow it to back up and restore Kubernetes persistent volume content. Ark’s volume DR capabilities come in two forms, one that uses cloud provider specific storage snapshot mechanisms and a more generic Open Source storage DR plugin call Restic. The advantage of Restic is that it is storage back end agnostic allowing one to potentially backup from one cluster to another with different storage back ends.</p><p>In this article we will walk through a quick DR scenario using Ark with Restic to back up and restore IBM Kubernetes Service (IKS) application along with its storage volumes. A simple overview of the process is as follows:</p><ol><li>Login (or first create) to your IBM Cloud Account.</li><li>Create and configure IBM object storage service.</li><li>Provision an IKS instance.</li><li>Install Ark Client.</li><li>Configure Ark and Restic.</li><li>Install Ark and Restic into your IKS cluster.</li><li>Deploy an application and make a change to the PV content.</li><li>Run Ark backup.</li><li>Delete the application and PV, simulating disaster.</li><li>Restore application from Ark/Restic Backup and all is well again.</li></ol><h4>Step 1. Login to the IBM Cloud (or create you free account if this is your first time)</h4><p><a href="https://console.cloud.ibm.com/">https://console.cloud.ibm.com</a></p><h4>Step 2. Create an IBM Cloud Object Storage Service Instance</h4><p>To store Kubernetes backups, you need a destination bucket in an instance of Cloud Object Storage (COS) and you have to configure service credentials to access this instance.</p><ul><li>If you don’t have a COS instance, you can create a new one, according to the detailed instructions in <a href="https://console.bluemix.net/docs/services/cloud-object-storage/basics/order-storage.html#creating-a-new-resource-instance?cm_sp=dw-bluemix-_-recipes-_-devcenter">Creating a new resource instance</a>.</li><li>The next step is to create a bucket for your backups. Ark and Restic will use the same bucket to store K8S configuration data as well as Volume backups. See instructions in <a href="https://console.bluemix.net/docs/services/cloud-object-storage/getting-started.html#create-buckets?cm_sp=dw-bluemix-_-recipes-_-devcenter">Create a bucket to store your data</a>. We are naming the bucket <strong>arkbucket</strong> and will use this name later to configure Ark backup location. You will need to choose another name for your bucket as IBM COS bucket names are globally unique. Choose “Cross Region” Resiliency so it is easy to restore anywhere.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hoieIhGcyB_aFmD5J7ZbgQ.png" /><figcaption>COS Bucket Creation (arkbucket shown but create resticbucket also)</figcaption></figure><ul><li>The last step in the COS configuration is to define a service that can store data in the bucket. The process of creating service credentials is described in <a href="https://console.bluemix.net/docs/services/cloud-object-storage/iam/service-credentials.html#service-credentials">Service credentials</a>. Several comments:</li></ul><blockquote>Your Ark service will write its backup into the bucket, so it requires the “Writer” access role.<br>Ark uses an AWS S3 compatible API. Which means it authenticates using a signature created from a pair of access and secret keys — a set of HMAC credentials. You can create these HMAC credentials by specifying <em>{“HMAC”:true}</em> as an optional inline parameter. See step 3 in the Service credentials guide.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XV9vr3C2aYWcEv-t.png" /></figure><ul><li>After successfully creating a Service credential, you can view the JSON definition of the credential. Under the cos_hmac_keys entry there are access_key_id and secret_access_key. We will use them later.</li></ul><h4>Step 3. Provision an Instance of IKS</h4><p><a href="https://console.bluemix.net/docs/containers/container_index.html#container_index">https://console.bluemix.net/docs/containers/container_index.html#container_index</a></p><p>A single zone cluster in US-East Region with 3 worker nodes is what we use in this example.</p><h4>Step 4. Download and Install Ark</h4><ul><li>Download Ark as described here: <a href="https://heptio.github.io/ark/v0.10.0/">https://heptio.github.io/ark/v0.10.0/</a>. A single tar ball download (<a href="https://github.com/heptio/ark/releases">https://github.com/heptio/ark/releases</a>) should install the Ark client program along with the required configuration files for your cluster.</li><li>Note that you will need Ark v0.10.0 or above for the Restic integration as shown in these instructions.</li><li>Add the Ark client program (ark) somewhere in your $PATH.</li></ul><h4>Step 5. Configure Ark Setup</h4><ul><li>Configure your kubectl client to access your IKS deployment.</li><li>From the Ark root directory, edit the file config/ibm/05-ark-backupstoragelocation.yaml file. Add your COS keys as a Kubernetes Secret named <strong>cloud-credentials</strong> as shown below. Be sure to update &lt;access_key_id&gt; and &lt;secret_access_key&gt; with the value from your IBM COS service credentials. The remaining changes in the file are in the section showing the <strong>BackupStorageLocation</strong> resource named <strong>default</strong>. Configure access to the bucket <strong>arkbucket (</strong>or whatever you called yours) by editing the <strong>spec.objectstore.bucket </strong>section of the file.<strong> </strong>Edit the COS<strong> region </strong>and<strong> s3URL </strong>to match your choices.<strong> </strong>The file should look something like this when done:</li></ul><pre>apiVersion: v1<br>kind: Secret<br>metadata:<br>  namespace: heptio-ark<br>  name: cloud-credentials<br>stringData:<br>  cloud: |<br>    [default]<br>    # UPDATE ME: the value of “access_key_id” of your COS service credential<br>    aws_access_key_id = &lt;<strong>access_key_id</strong>&gt;<br>    # UPDATE ME: the value of “secret_access_key” of your COS service credential<br>    aws_secret_access_key = &lt;<strong>secret_access_key</strong>&gt; <br>---<br>apiVersion: ark.heptio.com/v1<br>kind: BackupStorageLocation<br>metadata:<br>  name: default<br>  namespace: heptio-ark<br>spec:<br>  provider: aws<br>  objectStorage:<br>    bucket: <strong>arkbucket</strong><br>  config:<br>    s3ForcePathStyle: &quot;true&quot;<br>    s3Url:  <a href="http://s3-api.us-geo.objectstorage.softlayer.net/"><strong>http://s3-api.us-geo.objectstorage.softlayer.net</strong></a><br>    region: <strong>us-geo</strong></pre><h4>Step 6. Deploy Ark into your IBM IKS Instance</h4><p>Run the following commands from the Ark root directory:<br>kubectl apply -f config/common/00-prereqs.yaml</p><p>kubectl apply -f config/ibm/05-ark-backupstoragelocation.yaml</p><p>kubectl apply -f config/ibm/10-deployment.yaml</p><p>kubectl apply -f config/aws/20-restic-daemonset.yaml</p><p>Verify that Ark and Restic are running correctly on your IKS cluster with the following command:</p><p>kubectl -n heptio-ark get pods</p><p>which should show pods running similar to this:</p><pre>NAME READY STATUS RESTARTS AGE<br>ark-5464586757-q2crr 1/1 Running 0 5m<br>restic-7657v 1/1 Running 0 5m<br>restic-hh677 1/1 Running 0 5m<br>restic-mb9vh 1/1 Running 0 5m</pre><p>Note above that the count may vary as there is one Ark pod and a Restic Daemon set (in this case 3 pods, one per worker node).</p><h4>Step 7. Deploy a sample Application with a Volume to be Backed Up</h4><p>From the Ark root directory cut the yaml code below and save it asconfig/ibm/with-pv.yaml. We are creating a simple nginx deployment in its own namespace along with a service and a dynamically provisioned PV where we store nginx logs. Note the annotation: <strong>backup.ark.heptio.com/backup-volumes: nginx-logs</strong> below which tells Restic the volume name that we are interested in backing up.</p><pre>---<br>apiVersion: v1<br>kind: Namespace<br>metadata:<br> name: nginx-example<br> labels:<br>   app: nginx<br>---<br>kind: PersistentVolumeClaim<br>apiVersion: v1<br>metadata:<br> name: claim-nginx-logs<br> namespace: nginx-example<br> labels:<br>   app: nginx<br>   billingType: &quot;monthly&quot;<br> annotations:<br>   volume.beta.kubernetes.io/storage-class: &quot;ibmc-file-bronze&quot;<br>spec:<br> accessModes:<br>   - ReadWriteMany<br> resources:<br>   requests:<br>     storage: 24Gi<br>---<br>apiVersion: apps/v1beta1<br>kind: Deployment<br>metadata:<br> name: nginx-deployment<br> namespace: nginx-example<br>spec:<br> replicas: 1<br> template:<br>   metadata:<br>     annotations:<br>       backup.ark.heptio.com/backup-volumes: nginx-logs<br>     labels:<br>       app: nginx<br>   spec:<br>     volumes:<br>       - name: nginx-logs<br>         persistentVolumeClaim:<br>           claimName: claim-nginx-logs<br>     containers:<br>     - image: nginx:1.7.9<br>       name: nginx<br>       ports:<br>       - containerPort: 80<br>       volumeMounts:<br>         - mountPath: &quot;/var/log/nginx&quot;<br>           name: nginx-logs<br>           readOnly: false<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br> labels:<br>   app: nginx<br> name: my-nginx<br> namespace: nginx-example<br>spec:<br> ports:<br> - port: 80<br>   targetPort: 80<br> selector:<br>   app: nginx<br> type: LoadBalancer</pre><p>Now we can deploy this sample app by running the following from the Ark root directory:</p><pre>kubectl create -f config/ibm/with-pv.yaml</pre><p>We can check if the storage has been provision with:</p><pre>kubectl -n nginx-example get pvc</pre><p>You may have to run this over the course of a few minutes as the PVC gets bound. It will show pending but eventually show as bound similar to:</p><pre>NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE<br>claim-nginx-logs Bound pvc-cab7c88b-e908–11e8–8afb-c295f183323f 24Gi RWX ibmc-file-bronze 3m</pre><p>Now that we have a volume mounted we can find out the nginx pod name and put something in the volume (or just access the nginx web frontend and see access logs grow). Get your pod name with the following command (sample output shown):</p><pre>kubectl -n nginx-example get pods</pre><pre>NAME READY STATUS RESTARTS AGE<br>nginx-deployment-68fbbf4d7c-mkfnt 1/1 Running 0 10m</pre><p>Using the above pod name (yours will differ) we can log into the instance and add a file with the following commands:</p><pre>kubectl -n nginx-example exec -it nginx-deployment-68fbbf4d7c-mkfnt -- /bin/bash</pre><pre>root@nginx-deployment-68fbbf4d7c-mkfnt:/# cd /var/log/nginx<br>root@nginx-deployment-68fbbf4d7c-mkfnt:/var/log/nginx# echo “hw” &gt; hw.txt<br>root@nginx-deployment-68fbbf4d7c-mkfnt:/var/log/nginx# ls -al<br>total 16<br>drwxr-xr-x 2 nobody 4294967294 4096 Nov 15 19:22 .<br>drwxr-xr-x 1 root root 4096 Jan 27 2015 ..<br>-rw-r — r — 1 nobody 4294967294 530 Nov 15 19:13 access.log<br>-rw-r — r — 1 nobody 4294967294 219 Nov 15 19:12 error.log<br>-rw-r — r — 1 nobody 4294967294 3 Nov 15 19:24 hw.txt<br>root@nginx-deployment-68fbbf4d7c-mkfnt:/var/log/nginx# exit</pre><p>We now have some content we would expect to be saved and restored with the addition of our <strong>hw.txt</strong> file. You can, of course just access the nginx front end service via your browser and see the <strong>access.log</strong> grow also.</p><h4>Step 8. Use Ark and Restic to backup K8S config and volume.</h4><p>We can backup up our sample application by scoping the backup to the application’s namespace as follows:</p><pre>ark backup create my-nginx-bu --include-namespaces nginx-example</pre><pre>Backup request “my-nginx-bu” submitted successfully.<br>Run `ark backup describe my-nginx-bu` for more details.</pre><p>We can check the result with:</p><pre>ark backup describe my-nginx-bu --details</pre><p>which after repeating a few times the result should show a complete status.</p><p>If you examine your IBM Cloud COS bucket associated with the backup you will see that a set of files has appeared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nPxNfIODE3JmVGKRwt9VDw.png" /></figure><h4>Step 9. Simulating Disaster</h4><p>With the following commands we will delete our application configuration and the PV associated and confirm they are removed:</p><pre>kubectl delete namespace nginx-example<br>namespace “nginx-example” deleted</pre><pre>kubectl get pvc -n nginx-example<br>No resources found.</pre><pre>kubectl get pods -n nginx-example<br>No resources found.</pre><h4>Step 10. Recovering from Disaster</h4><p>We can restore the application and volume with the following command:</p><pre>ark restore create --from-backup my-nginx-bu</pre><pre>Restore request “my-nginx-bu-20181115145200” submitted successfully.<br>Run `ark restore describe my-nginx-bu-20181115145200` for more details.</pre><p>Restoring will take longer because we are dynamically provisioning another network drive behind the scenes. If we look at the status of our application it is “pending”:</p><pre>kubectl get pods -n nginx-example</pre><pre>NAME READY STATUS RESTARTS AGE<br>nginx-deployment-68fbbf4d7c-mkfnt 0/1 Pending 0 53s</pre><pre>kubectl get pvc -n nginx-example</pre><pre>NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE<br>claim-nginx-logs Pending ibmc-file-bronze 1m</pre><p>Within a minute or two we see our application is up and the volume recovered using the commands below (your pod name will differ). We dump our “hello world” file (<strong>hw.txt)</strong> and its contents are what we had per-disaster, mission accomplished!</p><pre>kubectl get pods -n nginx-example</pre><pre>NAME READY STATUS RESTARTS AGE<br>nginx-deployment-68fbbf4d7c-mkfnt 1/1 Running 0 6m</pre><pre>kubectl -n nginx-example exec -it nginx-deployment-68fbbf4d7c-mkfnt -- cat /var/log/nginx/hw.txt</pre><pre>hw</pre><h4>Advanced Use Cases</h4><p>In the previous example we walked through the straightforward situation where we simply wanted to restore an old version of an IKS cluster configuration and volumes to the same IKS cluster it was backed up from. The scenario was more of a backup/restore rather than a DR recovery. You likely would not have the same cluster available to restore to (or even the same IBM cloud region given a real catastrophe). In a disaster scenario where the region comes back online quickly this is fine if we can still meet RPO, RTO requirements. Below we discuss how to achieve a few advance use cases including multi-region DR, rapid cloning of environments for developer use and DR to/from on premise K8S instances like IBM Cloud Private (ICP).</p><h4>DR across IBM Cloud Regions</h4><p>A more likely DR scenario is where one would want to recover the backed up cluster in a completely different IBM Cloud Region from the original. As an example, I might have my primary cluster in IBM Cloud region US-East but have my DR cluster in US-South. The good news is that this scenario is easy to do with a little preparation and a similar set of steps. Rather then running the restore command on the US-East cluster I simply run on the US-South cluster (obviously you would have Kubectl client configured to US-South cluster). The one caveat with a cross region backup is that prior backing up and PVC you must remove labels tying the PVC to a local IBM Cloud region and zone. For each PVC to back up you would need to run the follow commands prior to backup command:</p><pre>kubectl -n <strong>&lt;namespace&gt;</strong> label pvc <strong>&lt;PVC name&gt; </strong>region-<br>kubectl -n <strong>&lt;namespace&gt;</strong> label pvc <strong>&lt;PVC name&gt; </strong>zone-</pre><p>With many PVCs this can be tiresome so a utility can be easily written. The utility can ideally be installed as an Ark pre-backup hook also.</p><h4>Developers Cloning Workspaces</h4><p>Often times a developer may want to debug a problematic deployment in a test or production cluster. Rather then take over the cluster to debug and potentially derail testing or even production activities the developer can simple clone the environment with Ark. Developers can provision their own clusters with lower cost cloud resource (less CPU, RAM or even fewer worker nodes) as needed. Developer clusters can be ephemeral given the rapid deployment of the cluster and the restored application.</p><h4>DR to/from any Kubernetes instances (multi-cloud)</h4><p>One can image many other useful scenarios where the desire is to backup/restore or migrate applications across clouds or to/from on premise Kubernetes. The good new is that Ark and Restic can support this as long as you have the same or equivalent volume storage available on the source and target. One scenario to try is to backup an IBM Cloud Private (ICP) on-prem cluster and restore it as an IKS cluster. One could imagine this as a dev/test cloning scenario with the developer using the cloud and IKS as an on-demand test bed. The destination cluster must have the same Kubernetes storageclass<strong> </strong>and compatible backend provisioner to that of the source. For example, if I am using the storageclass<strong> glusterfs</strong> on ICP and I want to restore to IKS I will need to provide the storageclass<strong> glusterfs</strong> in IKS<strong>. </strong>This can be done by simply adding a new storageclass definition for <strong>glusterfs</strong> on IKS but having it use the specification of something equivalent like <strong>ibmc-file-bronze </strong>(commonly used file volume provisioner on IKS).</p><h4>Summary</h4><p>Ark and Restic have made the lives of Kubernetes developers and administrators a lot easier when it comes to DR. Using ubiquitously available object storage as the backend, a Kubernetes API aware client and cluster runtime agents, Ark/Restic has solved the Kubernetes DR challenge in an elegant yet completely accessible way. Given its ease of use and reach feature set, Ark/Restic has expanded the set of achievable use cases to now include developer workflows and potentially even cloud to cloud migration. The sky is the limit with Ark cloud DR.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cae53cfe532" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>