<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Art Anderson</title>
    <description>The latest articles on Forem by Art Anderson (@artanderson).</description>
    <link>https://forem.com/artanderson</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F850226%2F008090ac-e2ec-473a-8659-b54ac485cd3b.png</url>
      <title>Forem: Art Anderson</title>
      <link>https://forem.com/artanderson</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/artanderson"/>
    <language>en</language>
    <item>
      <title>Deploying from Scratch - A journey in parts</title>
      <dc:creator>Art Anderson</dc:creator>
      <pubDate>Sat, 29 Oct 2022 00:14:59 +0000</pubDate>
      <link>https://forem.com/aerospike/deploying-from-scratch-a-journey-in-parts-33e6</link>
      <guid>https://forem.com/aerospike/deploying-from-scratch-a-journey-in-parts-33e6</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BYDZEWXq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://images.unsplash.com/photo-1453227588063-bb302b62f50b%3Fixlib%3Drb-4.0.3%26ixid%3DMnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8%26auto%3Dformat%26fit%3Dcrop%26w%3D2340%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BYDZEWXq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://images.unsplash.com/photo-1453227588063-bb302b62f50b%3Fixlib%3Drb-4.0.3%26ixid%3DMnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8%26auto%3Dformat%26fit%3Dcrop%26w%3D2340%26q%3D80" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@matthewhenry"&gt;Matthew Henry&lt;/a&gt; on &lt;a href="https://unsplash.com/"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is the first in a series of blog posts intended to help folks who may be struggling with deployment of an Aerospike database. I'm part of the Aerospike Developer Relations team, but I spend most of my days playing around with websites or writing code samples, and not deploying databases in real-world contexts. I hope that you can follow along with me as I fumble my way through a production build and create a tool that will not only help me with my job, but also help me learn a whole lot more about Aerospike.&lt;/p&gt;

&lt;p&gt;Let me make the mistakes so you don't have to! Or do make them, that's cool too.&lt;/p&gt;

&lt;h2&gt;
  
  
  The situation
&lt;/h2&gt;

&lt;p&gt;I have two websites, hosted on &lt;a href="https://www.netlify.com"&gt;Netlify&lt;/a&gt;, that generate traffic logs. I want to analyze those traffic logs to see what is currently being used, and what gaps exist, within our content.&lt;/p&gt;

&lt;p&gt;Netlify provides these logs - JSON documents - through a log drain that can hook up to a variety of third-party monitoring services. Those are great, but I want to keep everything in house (in my own cloud?), so I'll start by exploring the options to send logs to &lt;a href="https://aws.amazon.com/s3/"&gt;Amazon's Simple Storage Service (S3)&lt;/a&gt;, or to my own http endpoint.&lt;/p&gt;

&lt;p&gt;Once the logs hit S3, or my endpoint, I need to store them somewhere - enter Aerospike. I want Aerospike to ingest the logs and allow me to query data from a dashboard of my making. Defining a good data model is important, as it can prevent a lot of client-side processing, letting the server do the heavy lifting. &lt;/p&gt;

&lt;p&gt;Step one - make a plan.&lt;/p&gt;

&lt;h2&gt;
  
  
  The plan
&lt;/h2&gt;

&lt;p&gt;If I'm going to do this, I may as well overdo this, so lets get wild and go with a Kubernetes cluster on &lt;a href="https://aws.amazon.com/"&gt;Amazon Web Services (AWS)&lt;/a&gt;, maybe a few serverless &lt;a href="https://aws.amazon.com/lambda/"&gt;Lambda functions&lt;/a&gt;, some connectors, and whatever else might be fun to play around with. &lt;/p&gt;

&lt;p&gt;But for now, the basics. This is what I'm hoping to accomplish. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;a href="https://aws.amazon.com/vpc/"&gt;Virtual Private Cloud (VPC)&lt;/a&gt; on AWS.&lt;/li&gt;
&lt;li&gt;Deploy an &lt;a href="https://aws.amazon.com/eks/"&gt;AWS Elastic Kubernetes Service (EKS)&lt;/a&gt; cluster in the VPC.&lt;/li&gt;
&lt;li&gt;Deploy an &lt;a href="https://docs.aerospike.com/cloud/kubernetes/operator"&gt;Aerospike cluster&lt;/a&gt; within the EKS cluster.&lt;/li&gt;
&lt;li&gt;Create a data model that best suits the query needs against the documents being stored.&lt;/li&gt;
&lt;li&gt;Get said documents from Netlify's log drain to Aerospike.&lt;/li&gt;
&lt;li&gt;Build a dashboard to retrieve and analyze data.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sounds easy enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  A note on execution
&lt;/h2&gt;

&lt;p&gt;This post focuses on steps one, two, and three of the plan. As we go through how I set this up, remember that the steps I took are what worked best for me as I learned my way through it. If you find a better path, I would love to hear about it.&lt;/p&gt;

&lt;p&gt;For this series, I assume you have some basic knowledge of working with AWS. If you're new to the platform, checkout the &lt;a href="https://aws.amazon.com/getting-started/"&gt;getting started guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The VPC
&lt;/h2&gt;

&lt;p&gt;Credit where credit is due, &lt;a href="https://warolv.medium.com/building-the-ci-cd-of-the-future-creating-the-vpc-for-eks-cluster-a69b085441d1"&gt;this Medium post&lt;/a&gt; was a massive help to me in getting this setup. I followed along and used &lt;a href="https://amazon-eks.s3.us-west-2.amazonaws.com/cloudformation/2020-06-10/amazon-eks-vpc-private-subnets.yaml"&gt;this AWS CloudFormation template&lt;/a&gt;. The template creates an EKS-ready VPC that includes: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an internet gateway connected to two availability zones. &lt;/li&gt;
&lt;li&gt;a public and private subnet in each availability zone. &lt;/li&gt;
&lt;li&gt;a route table allowing access to the private subnet. &lt;/li&gt;
&lt;li&gt;a NAT gateway with an Elastic IP, connecting to the route table.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whew!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kfdwveYa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://developer-hub.s3.us-west-1.amazonaws.com/art-anderson/AWS-Netlify_1666723208868.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kfdwveYa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://developer-hub.s3.us-west-1.amazonaws.com/art-anderson/AWS-Netlify_1666723208868.png" width="800" height="586"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A simple diagram of our VPC&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The goal of the template is to have the EKS worker nodes in the private subnet, while the control plane lives in the public subnet. That allows access to the cluster endpoint from outside the VPC, but worker nodes and their traffic are confined to the VPC. More on this later.  &lt;/p&gt;

&lt;p&gt;To start, log into your AWS account, navigate to the &lt;a href="https://aws.amazon.com/cloudformation/"&gt;CloudFormation&lt;/a&gt; tool, and follow the steps to create a stack. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the template link above and plug it into the &lt;strong&gt;Amazon S3 URL&lt;/strong&gt; input.
&lt;/li&gt;
&lt;li&gt;On the next page give the stack a name and define the &lt;strong&gt;Worker Network Config&lt;/strong&gt; (I left everything at the defaults).&lt;/li&gt;
&lt;li&gt;Click through the next few pages, leaving the defaults (or not, I'm not your boss), then create the stack.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I did have to repeat this step a few times because I didn't realize that my account already had five Elastic IPs in use. If you're in the same boat as I was, you can do some cleanup or contact Amazon for more Elastic IPs.  &lt;/p&gt;

&lt;p&gt;It takes a few minutes to get everything setup, and after completion we can add one last thing - tags. &lt;/p&gt;

&lt;p&gt;This step eluded many setup guides and threw me for a loop for quite some time. I'm sure there's a better way to do this, but this is how I went about tagging my subnets. &lt;/p&gt;

&lt;p&gt;Head over to the VPC dashboard, select &lt;strong&gt;Subnets&lt;/strong&gt; from the sidebar, then select each subnet one by one and add these tags:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;kubernetes.io/role/internal-elb&lt;/code&gt; (&lt;strong&gt;Only on private subnets&lt;/strong&gt;)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;kubernetes.io/role/elb&lt;/code&gt; (&lt;strong&gt;Only on public subnets&lt;/strong&gt;)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;kubernetes.io/cluster/&amp;lt;your-cluster-name&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;shared&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We haven't created the EKS cluster yet, but if the name is already known, add the tag now. Otherwise, come back after creation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cluster (EKS)
&lt;/h2&gt;

&lt;p&gt;I'm not going to lie, this part I struggled with - a lot. I highly recommend familiarizing yourself with the &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html"&gt;EKS getting started guide&lt;/a&gt;, though I do say, it only helped moderately. Breaking things a number of times is really where I feel I learned the most.&lt;/p&gt;

&lt;p&gt;I went through the majority of this using the AWS Management Console. You can do most, if not all, of what I'm about to do through &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html"&gt;&lt;code&gt;eksctl&lt;/code&gt;&lt;/a&gt;. Feel free to check that out if the command line is more your speed. &lt;/p&gt;

&lt;p&gt;You need to install a few tools first: &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html"&gt;&lt;code&gt;kubectl&lt;/code&gt;&lt;/a&gt; to interact with the Kubernetes cluster from the terminal, and &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html"&gt;&lt;strong&gt;AWS Command Line Interface (CLI)&lt;/strong&gt;&lt;/a&gt; to interact with AWS from the terminal. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important!&lt;/strong&gt; the &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html"&gt;Identity and Access Management (IAM)&lt;/a&gt; entity used to create the EKS cluster is the only IAM entity with access to the cluster after creation. You can add users later, just &lt;strong&gt;don't use a root user!&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Roles
&lt;/h3&gt;

&lt;p&gt;Lets start by creating a few &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html"&gt;IAM roles&lt;/a&gt; necessary for the EKS cluster to function. These roles give the deployment the permissions they need to interact with other AWS resources. &lt;/p&gt;

&lt;p&gt;Head over to the IAM dashboard and select &lt;strong&gt;Roles&lt;/strong&gt; from the left sidebar. Click &lt;strong&gt;Create role&lt;/strong&gt; in the top right to get started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EKSClusterRole&lt;/strong&gt;: this role is used when creating the cluster. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select &lt;strong&gt;Custom trust policy&lt;/strong&gt; and add the following to the JSON document and click next.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
             &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
             &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                 &lt;/span&gt;&lt;span class="nl"&gt;"Service"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"eks.amazonaws.com"&lt;/span&gt;&lt;span class="w"&gt;
             &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
             &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;Permissions policies&lt;/strong&gt; search field type &lt;strong&gt;eks&lt;/strong&gt; and hit return. Select the &lt;strong&gt;AmazonEKSClusterPolicy&lt;/strong&gt; and click next.&lt;/li&gt;
&lt;li&gt;Give the role a unique name and description and click &lt;strong&gt;Create role&lt;/strong&gt; at the bottom to finish.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;EKSNodeRole&lt;/strong&gt;: this role is used for node creation and gives EKS access to &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html"&gt;Elastic Compute Cloud (EC2)&lt;/a&gt;. Follow the same steps as above, with these small changes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the trust policy, swap &lt;code&gt;"Service": "eks.amazonaws.com"&lt;/code&gt; with &lt;code&gt;"Service": "ec2.amazonaws.com"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In the permissions policies select &lt;strong&gt;AmazonEKSWorkerNodePolicy&lt;/strong&gt; and &lt;strong&gt;AmazonEC2ContainerRegistryReadOnly&lt;/strong&gt;. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you're following the AWS docs, you may have noticed they say to also add &lt;strong&gt;AmazonEKS_CNI_Policy&lt;/strong&gt;. We'll create a separate role for that before creating any cluster nodes, as it is a best practice to separate the CNI role from the Node role in production clusters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Into the kube
&lt;/h3&gt;

&lt;p&gt;Now that we've setup a few base roles, head over to the &lt;a href="https://console.aws.amazon.com/eks/home#/clusters"&gt;EKS console&lt;/a&gt; to create the EKS cluster.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After you click &lt;strong&gt;Add cluster&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Create&lt;/strong&gt;, add the cluster name and select the &lt;strong&gt;EKSClusterRole&lt;/strong&gt; role setup above. Click next when complete.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On the networking page, select the VPC created earlier. The subnets should automatically populate and select the control plane security group that was created with the VPC. &lt;/p&gt;

&lt;p&gt;I started with the &lt;strong&gt;Public and private&lt;/strong&gt; option for &lt;strong&gt;Cluster endpoint access&lt;/strong&gt; but eventually switched to &lt;strong&gt;Private&lt;/strong&gt;. I'll discuss this in another post, but for now, &lt;strong&gt;Public and private&lt;/strong&gt; works fine. I left all add-ons at the defaults as well.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Leave everything else at the defaults, at least that's what I did. Click next until you are able to click &lt;strong&gt;Create&lt;/strong&gt;, then wait until the cluster is active.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With that done, we can now setup our &lt;strong&gt;EKSVPCCNIRole&lt;/strong&gt; role. This role controls VPC networking for pods on our cluster nodes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;We'll start with a little setup. Hopefully you've already installed and setup &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html"&gt;&lt;strong&gt;AWS CLI&lt;/strong&gt;&lt;/a&gt; and installed &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html"&gt;&lt;code&gt;kubectl&lt;/code&gt;&lt;/a&gt;. If not, go do that now. &lt;/p&gt;

&lt;p&gt;From the terminal run the following command to setup communication between your machine and the cluster (this isn't necessary right now, but we may as well make the connection).&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws eks update-kubeconfig --region &amp;lt;your-region-code&amp;gt; --name &amp;lt;your-cluster-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Run the following to get the cluster's OIDC provider URL:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws eks describe-cluster --name &amp;lt;your-cluster-name&amp;gt; --query "cluster.identity.oidc.issuer" --output text
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;It should look like this:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE 
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Copy it, head over to the &lt;a href="https://console.aws.amazon.com/iam/"&gt;IAM console&lt;/a&gt;, and select &lt;strong&gt;Identity providers&lt;/strong&gt; from the left sidebar.  &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If there isn't already a provider that exists with the URL from step two, click &lt;strong&gt;Add provider&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;OpenID Connect&lt;/strong&gt;, add the URL from step one to the &lt;strong&gt;Provider URL&lt;/strong&gt; field, click &lt;strong&gt;Get thumbprint&lt;/strong&gt;, add &lt;code&gt;sts.amazonaws.com&lt;/code&gt; to the &lt;strong&gt;Audience&lt;/strong&gt; field, and click &lt;strong&gt;Add provider&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now that we have all that set, follow the role creation steps from before, this time using the following for the trust provider (fill in your info accordingly):&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"Federated"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:iam::&amp;lt;your-aws-account-id&amp;gt;:oidc-provider/oidc.eks.&amp;lt;your-region&amp;gt;.amazonaws.com/id/&amp;lt;your-oidc-id&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sts:AssumeRoleWithWebIdentity"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Condition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"StringEquals"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"oidc.eks.&amp;lt;your-region&amp;gt;.amazonaws.com/id/&amp;lt;your-oidc-id&amp;gt;:aud"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sts.amazonaws.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"oidc.eks.&amp;lt;your-region&amp;gt;.amazonaws.com/id/&amp;lt;your-oidc-id&amp;gt;:sub"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"system:serviceaccount:kube-system:aws-node"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then select the &lt;strong&gt;AmazonEKS_CNI_Policy&lt;/strong&gt; for the permissions policies.&lt;/p&gt;

&lt;p&gt;Finally, head back into the &lt;a href="https://console.aws.amazon.com/eks/home#/clusters"&gt;EKS console&lt;/a&gt;, open the cluster, select &lt;strong&gt;Add-ons&lt;/strong&gt;, open the &lt;strong&gt;vpc-cni&lt;/strong&gt; add-on, click &lt;strong&gt;Edit&lt;/strong&gt;, then select the new role we just created and click &lt;strong&gt;Update&lt;/strong&gt;. This will take a few minutes to complete.&lt;/p&gt;

&lt;p&gt;We have a cluster! Holy cow, there is still so much more to do...&lt;/p&gt;

&lt;h3&gt;
  
  
  Nodes
&lt;/h3&gt;

&lt;p&gt;The nodes created and used within the cluster are largely dependent on your use case. For this project I setup a node group with two nodes, &lt;a href="https://aws.amazon.com/ec2/instance-types/?trk=36c6da98-7b20-48fa-8225-4784bced9843&amp;amp;sc_channel=ps&amp;amp;s_kwcid=AL!4422!3!536392643179!p!!g!!amazon%20ec2%20instance&amp;amp;ef_id=Cj0KCQjwkt6aBhDKARIsAAyeLJ0LvB34xyCl8lF59J3achR6z4GbM4DPF3AjjsZft57SGxVltOBO-rwaAoHNEALw_wcB:G:s&amp;amp;s_kwcid=AL!4422!3!536392643179!p!!g!!amazon%20ec2%20instance"&gt;r5a.large EC2 instances&lt;/a&gt;, each with a 400GB &lt;a href="https://aws.amazon.com/ebs/"&gt;Elastic Block Storage (EBS)&lt;/a&gt; volume that I'll be setting up for persistent storage. I'm not doing any &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/autoscaling.html"&gt;autoscaling&lt;/a&gt; - yet, but you may want to explore that avenue. &lt;/p&gt;

&lt;p&gt;When setting up the node group, use the &lt;strong&gt;EKSNodeRole&lt;/strong&gt; from earlier. Checkout &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html"&gt;Creating a managed node group&lt;/a&gt; for more detailed instructions. &lt;/p&gt;

&lt;h2&gt;
  
  
  The operator
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://docs.aerospike.com/cloud/kubernetes/operator"&gt;Aerospike Kubernetes Operator&lt;/a&gt; is built to automate deployment and management of Aerospike clusters in Kubernetes. &lt;/p&gt;

&lt;p&gt;Our great engineers and technical writers have already put together an awesome guide on installing the &lt;a href="https://docs.aerospike.com/cloud/kubernetes/operator/install-operator"&gt;operator&lt;/a&gt; and &lt;a href="https://docs.aerospike.com/cloud/kubernetes/operator/create-cluster-kubectl"&gt;deploying an Aerospike cluster&lt;/a&gt;. What I want to talk about are the problems I ran into during my journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  OLM
&lt;/h3&gt;

&lt;p&gt;The two available paths for setup use either Helm or &lt;a href="https://olm.operatorframework.io/"&gt;Operator Lifecycle Manager (OLM)&lt;/a&gt;. I went down the OLM path and can say that after my first small hiccup, it was a pretty smooth sailing. The problem I ran into was with the install. Maybe I did it to myself by going down the &lt;code&gt;kubectl&lt;/code&gt; path for installation - we'll never know - but regardless, this is what happened.&lt;/p&gt;

&lt;p&gt;First, I used the following commands to install OLM:&lt;/p&gt;

&lt;p&gt;1.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/&amp;lt;olm_release&amp;gt;/crds.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/&amp;lt;olm_release&amp;gt;/olm.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The problem arose from the fact that command one was missing an important flag, failing the install and leaving me with a non-function OLM. Adding &lt;code&gt;--server-side=true&lt;/code&gt; to the first command remedied that problem for me. &lt;/p&gt;

&lt;p&gt;After getting past that hurdle I ran into one more issue with my deployment - storage. &lt;/p&gt;

&lt;h3&gt;
  
  
  Storage
&lt;/h3&gt;

&lt;p&gt;I used the &lt;a href="https://github.com/aerospike/aerospike-kubernetes-operator/blob/2.2.1/config/samples/ssd_storage_cluster_cr.yaml"&gt;&lt;code&gt;ssd_storage_cluster_cr.yaml&lt;/code&gt;&lt;/a&gt; template for deployment, which requires persistent storage and a provisioned storage class in my EKS cluster.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/managing-ebs-csi.html"&gt;&lt;strong&gt;aws-ebs-csi-driver&lt;/strong&gt;&lt;/a&gt; is required to make this work and is easily missed if you are not familiar with EKS. This driver is responsible for managing the lifecycle of EBS volumes for persistent storage.&lt;/p&gt;

&lt;p&gt;To setup the &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/managing-ebs-csi.html"&gt;&lt;strong&gt;aws-ebs-csi-driver&lt;/strong&gt;&lt;/a&gt; we'll create a role and install an add-on in the cluster. To create the role, I'll let the good folks at Amazon take you through &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/csi-iam-role.html"&gt;step by step&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once the role is ready, head over to the EKS console and select the cluster. Click &lt;strong&gt;Add-ons&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add new&lt;/strong&gt; then select &lt;strong&gt;Amazon EBS CSI Driver&lt;/strong&gt; and the role you just created for the &lt;strong&gt;Service account role&lt;/strong&gt; and click &lt;strong&gt;Add&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Once the add-on is installed, follow through the rest of the operator setup (it's actually super easy!) and you should be rocking an Aerospike cluster in no time!&lt;/p&gt;

&lt;h2&gt;
  
  
  What would I do different?
&lt;/h2&gt;

&lt;p&gt;Take the time to learn &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html"&gt;&lt;code&gt;eksctl&lt;/code&gt;&lt;/a&gt; and use the &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html"&gt;AWS CLI&lt;/a&gt; more. &lt;/p&gt;

&lt;p&gt;These tools take you out of the Management Console and can simplify a lot of the setup. That said, I learn by making mistakes, and I find that it's a lot easier to see my mistakes in the Management Console. Your mileage may vary.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;Keep your eyes peeled for the next installation of this harrowing journey, where we'll talk data modeling and (hopefully) set things up right. Then, maybe we can get into storing and accessing said data, and who knows what else. This project is here to be overdesigned to our hearts content. Let's play around a little.&lt;/p&gt;

&lt;p&gt;Check out our &lt;a href="https://docs.aerospike.com"&gt;docs&lt;/a&gt; and our &lt;a href="https://developer.aerospike.com"&gt;Developer Hub&lt;/a&gt; for more great Aerospike content and an interactive sandbox to mess with.&lt;/p&gt;

</description>
      <category>document</category>
      <category>kubernetes</category>
      <category>operator</category>
      <category>eks</category>
    </item>
  </channel>
</rss>
