<?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>DEV Community: Fred Richards</title>
    <description>The latest articles on DEV Community by Fred Richards (@flrichar).</description>
    <link>https://dev.to/flrichar</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%2F190376%2Ffa3a8945-049c-48f9-925a-06f2438e81a2.jpg</url>
      <title>DEV Community: Fred Richards</title>
      <link>https://dev.to/flrichar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/flrichar"/>
    <language>en</language>
    <item>
      <title>Stuff in my Lab, it Evolves</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Fri, 27 May 2022 20:51:10 +0000</pubDate>
      <link>https://dev.to/flrichar/stuff-in-my-lab-it-evolves-172g</link>
      <guid>https://dev.to/flrichar/stuff-in-my-lab-it-evolves-172g</guid>
      <description>&lt;p&gt;I realized recently I haven't written much.  Subject matter came to mind about specific situations, or recent experiments, but then I thought why not just talk about the Lab.  It's constantly changing and evolving, and besides, it will be a fun thing to drone on about.&lt;/p&gt;

&lt;p&gt;One of my main philosophies is keeping things as simple as possible, to the lowest common denominator.  Considering I work with Kubernetes, with its massive amounts of abstractions, you'd think this is a paradox. These philosophies, or tenets, or principals, whatever you'd like to call them, will sometimes pop in my head as simple sentences.  "Keep it simple".  "Follow the convention".  You get the idea.&lt;/p&gt;

&lt;p&gt;Years ago my lab was a mess. For a living, I build stuff. Sometimes it was building Linux servers, or network services. Sometimes building networks themselves.  Sometimes it was building cloud architecture.  So I had to decide, what did I want out of my lab?&lt;/p&gt;

&lt;p&gt;I wanted a quick way to test VMs.  New version of Debian released?  Ok, spin up a small vm and test it out.  I wrote some scripts to call qemu-kvm on the commandline, made a dedicated routed vm-only network and connected it with a virtual switch, namely OpenVSwitch.  These scripts were normally ansible and/or bash.  There is not much these scripts do that one cannot get out of libvirt tools these days.  My tooling was just born before libvirt was popular and matured.&lt;/p&gt;

&lt;p&gt;This worked for a great while, but again, introduce Kubernetes.  It is by it's very nature an affront to my minimalist habits!&lt;/p&gt;

&lt;p&gt;So the next great step? K3s.  I could run the very same guest VMs I have always, pop k3s on them and now, BOOM, they're a single-node cluster. This also works well, because one can create automation that spins up the vms, installs k3s and then applies manifests or other api-like behavior.  The whole stack can spin up onsite, and with a bit of tweaking, under your favorite cloud provider.&lt;/p&gt;

&lt;p&gt;Recently it's evolved even further.  Sometimes I need not only a minimal cluster of 1-2 nodes, but an ephemeral one, something that will not live long.  Spin up a cluster, run some experiment, or QA-like operation, capture result data, then destroy everything.  This may just be peak-minimalism.&lt;/p&gt;

&lt;p&gt;So now I use k3d and skip the guest VM middle man. OR get this, maybe run k3d inside the VM, if for some reason the single-node-lab-in-a-box needs to be fungible.  &lt;/p&gt;

&lt;p&gt;Some people run clusters of huge boxes, or massive datacenters filled with physical machines, or even clusters with thousands of nodes.  Not me, I'll have dozens of optimized clusters and guest VMs in my lab, along with their resulting data, configs, backups, and the automation to create it all over again if needed.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>K3S Upgrades with Fleet</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Mon, 09 May 2022 20:42:15 +0000</pubDate>
      <link>https://dev.to/flrichar/k3s-upgrades-with-fleet-1cd9</link>
      <guid>https://dev.to/flrichar/k3s-upgrades-with-fleet-1cd9</guid>
      <description>&lt;p&gt;K3s has a great option to automate upgrades with the system-upgrade-controller.  While SUC may seem like an odd name it does work well. Why can't we automate the upgrades of k3s with gitops?&lt;/p&gt;

&lt;p&gt;In my lab, I traditionally run a bunch of small Linux VM guests of differing operating system distributions, and recently decided to make them single-node k3s clusters.  I have at any time, about six of these either guest kvm machines or raspberry pi-style computers running k3s in the lab.&lt;/p&gt;

&lt;p&gt;The system-upgrade-controller for k3s is simple, it takes a custom resource called a Plan and it applies to nodes with a certain label, like &lt;code&gt;k3s-upgrade=true&lt;/code&gt;. The three step process looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install system-upgrade-controller&lt;/li&gt;
&lt;li&gt;apply any Plans that are required&lt;/li&gt;
&lt;li&gt;label nodes to trigger the upgrade, per Plan&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This works if the cluster consists of one node or 100 nodes.  My lab is pretty minimalistic, so I want to keep any gitops light and simple.&lt;/p&gt;

&lt;p&gt;Fleet can use mainfests, kustomize, helm charts, or any combination of the three.  To keep with the minimalist theme, I use manifests.  More info on the Fleet architecture is &lt;a href="http://fleet.rancher.io/architecture/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Fleet can use the three-step process above to upgrade each of the k3s clusters. I decided to let Fleet handle the first two steps, and the third is already covered by other automation.  &lt;/p&gt;

&lt;p&gt;I've carefully planned out the organization of how my Fleet gitops will operate.  Here are my definition for common Fleet topics -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Workspace - a simple namespace, on the local Rancher cluster where the fleet-controller lives.&lt;/li&gt;
&lt;li&gt;GitRepo - a path from a repo that Clusters subscribe to.  Note: using a path makes it flexible, that way one can have a lot of GitRepos under one hosted provider like Github or Gitlab.&lt;/li&gt;
&lt;li&gt;Clusters - the downstreams that will subscribe to certain GitRepos under Workspaces.&lt;/li&gt;
&lt;li&gt;ClusterGroups - grouping of clusters by common criteria, project, or attribute.  I often group my project, or create empty groups for later.&lt;/li&gt;
&lt;li&gt;Bundle - a fleet.yaml manifest describing what is to be deployed.&lt;/li&gt;
&lt;li&gt;BundleDeployment - gluing together the Bundle and the relevant GitRepos, applied to certain ClusterGroups, after it is deployed to specific Clusters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is a tree-view example of my GitRepo paths ...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;├── bitnami
│   ├── openldap
│   │   ├── fleet.yaml
│   │   └── openldap.yaml
│   └── README.md
├── default-dev
│   ├── plan
│   │   ├── 121-12-plan.yaml
│   │   └── fleet.yaml
│   ├── README.md
│   └── upgr
│       ├── fleet.yaml
│       └── system-upgrade-controller.yaml
├── gxize-testing
│   ├── rancher
│   │   └── longhorn
│   │       ├── fleet.yaml
│   │       └── longhorn.yaml
│   └── README.md
├── k3s
│   ├── plans
│   │   ├── 121-11-plan.yaml
│   │   └── 121-12-plan.yaml
│   ├── readme.md
│   └── suc
│       ├── fleet.yaml
│       └── system-upgrade-controller.yaml
├── README.md
└── zerk-final
    └── README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll notice a few organizational choices, first, the bitnami and k3s paths are not only named for vendors, but also are temporary spaces with nothing pointing to them. I could remove these entirely and no clusters are subscribed to these dirs, so nothing would happen.&lt;/p&gt;

&lt;p&gt;The next is my three-tier lifecycle, dev, testing and final (like prod).  For the k3s system-upgrade project, we're only concerned with the &lt;code&gt;/default-dev&lt;/code&gt; path.  Under my UI, this is called &lt;code&gt;general&lt;/code&gt;.  I also decided to keep everything under the default Fleet namespace, &lt;code&gt;fleet-default&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Bundles and BundleDeployments will derive their names from the &lt;code&gt;&amp;lt;GitRepo_Name&amp;gt;-&amp;lt;Bundle_Path&amp;gt;&lt;/code&gt;.  So a Bundle name might be from the example above &lt;code&gt;general-default-dev-upgr&lt;/code&gt;.  &lt;/p&gt;

&lt;p&gt;Lastly, I created a bunch of ClusterGroups on different criteria.  Sometimes this is the networking on the node, the node's OS, or just by project name. &lt;br&gt;
I would suggest and recommend to make empty groups, it will assist in organization later.  For this project in my dev environment of three clusters, I had a pre-existing &lt;code&gt;zone-orange&lt;/code&gt; ClusterGroup, which keys on the label &lt;code&gt;zone=orange&lt;/code&gt; for each cluster.  If I wish to add or remove clusters from the ClusterGroup, I simply add or remove the label.&lt;/p&gt;

&lt;p&gt;From my three-step process above, I want Fleet to install the upgrade-controller and the Plan.  I create &lt;code&gt;fleet.yaml&lt;/code&gt; bundles in my Git Repo, under the proper GitRepo-path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.../general$ cat default-dev/upgr/fleet.yaml                                           
defaultNamespace: default
targetCustomizations:                                                                              
- name: upgr-orange
  clusterGroup: zone-orange                                                                        

.../general$ cat default-dev/plan/fleet.yaml                                           
defaultNamespace: default
targetCustomizations:                                                                              
- name: upgr-orange
  clusterGroup: zone-orange                                                                        
  dependsOn: general-default-dev-upgr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;... note the &lt;code&gt;dependsOn&lt;/code&gt; option, this means that the second Bundle for the Plan relies on an Active status of the first Bundle for the system-upgrade-controller.&lt;/p&gt;

&lt;p&gt;Once I commit these changes into git, the fleet-controller picks up any changes because the hash has changed, and pushes those changes to the ClusterGroups mentioned in the fleet.yaml Bundle.  I can also check the status of the BundleDeployments to ensure all three clusters have both the system-upgrade-controller and plan manifests completed.&lt;/p&gt;

&lt;p&gt;My last step, is to run &lt;code&gt;kubectl label node/&amp;lt;node-name&amp;gt; k3s-upgrade=true&lt;/code&gt; as per the nodeSelector in the Plan.  This allows me to control the cadence of the upgrades on a per-node basis, and there is also a &lt;code&gt;.spec.concurrency&lt;/code&gt; to cordon/upgrade nodes in batches if these were more than one node.&lt;/p&gt;

&lt;p&gt;After I'm satisfied with the upgrade, I can remove the label ... &lt;code&gt;kubectl label node/&amp;lt;node-name&amp;gt; k3s-upgrade-&lt;/code&gt; ... in preparation for the next upgrade.  &lt;/p&gt;

&lt;p&gt;Now that everything is in place and organized, my next upgrade is updating at least the Plan manifest, committing git changes, and labeling the nodes again.&lt;/p&gt;

&lt;p&gt;Some pointers and tips - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;consider the GitRepo as a path, use these paths for your own project's organization.&lt;/li&gt;
&lt;li&gt;manage ClusterGroups, not Clusters!  Creating empty groups can help plan for the future.&lt;/li&gt;
&lt;li&gt;you can use one repo for different lifecycles, or use different Workspaces for different lifecycles/projects.
&lt;/li&gt;
&lt;li&gt;use dependsOn with the Bundle name for when you require pieceA to be ready before pieceB, for example with supporting crds before a specific helm chart.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>k3s</category>
      <category>fleet</category>
    </item>
    <item>
      <title>Log4j Vulnerability -- CVE-2021-44228</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Sat, 11 Dec 2021 21:54:23 +0000</pubDate>
      <link>https://dev.to/flrichar/log4j-vulnerabilty-cve-2021-44228-1g4</link>
      <guid>https://dev.to/flrichar/log4j-vulnerabilty-cve-2021-44228-1g4</guid>
      <description>&lt;p&gt;Lots of my technology friends are concerned about the new CVE-2021-44228, the log4j vulnerability. What should you do? First of all, don't panic. Yes, the library is widely used -- in software which leverages java. If your code or app isn't java there's a slim to no chance it will be affected. If you do find the code is java-based, check with your vendor. Even my home lab uses the UniFi controller from Ubiquiti, and they promptly released a patch this weekend.&lt;br&gt;
(&lt;a href="https://community.ui.com/releases/UniFi-Network-Application-6-5-54/d717f241-48bb-4979-8b10-99db36ddabe1"&gt;https://community.ui.com/releases/UniFi-Network-Application-6-5-54/d717f241-48bb-4979-8b10-99db36ddabe1&lt;/a&gt;)&lt;br&gt;
Rest assured your friendly neighborhood software vendor is on it!&lt;/p&gt;

</description>
      <category>security</category>
      <category>java</category>
    </item>
    <item>
      <title>Shift the TZ for your K8s CronJobs</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Fri, 19 Feb 2021 18:31:20 +0000</pubDate>
      <link>https://dev.to/flrichar/shift-the-tz-for-your-k8s-cronjobs-52c</link>
      <guid>https://dev.to/flrichar/shift-the-tz-for-your-k8s-cronjobs-52c</guid>
      <description>&lt;p&gt;In your Kubernetes clusters, the timezone is typically assumed to be UTC, which is a very cloud-native way to provision things.  The resources you have might be across the globe, so having every node or host use the same timezone makes sense, especially if you're correlating information in logs.&lt;/p&gt;

&lt;p&gt;But in other environments, there is a need to have the local timezone configured.  &lt;/p&gt;

&lt;p&gt;What happens if your cronjobs in the cluster are not aligned with the local timezone?  This could cause some minor havoc.  &lt;/p&gt;

&lt;p&gt;The answer is simple.  The timezone settings for cronjobs are managed by the &lt;code&gt;kube-controller-manager&lt;/code&gt; component.  Assuming all of your control-plane nodes are provisioned prior with localized and correct timezone settings, just add an extra mount, adding in &lt;code&gt;/etc/localtime&lt;/code&gt; into the &lt;code&gt;kube-controller-manager&lt;/code&gt; component.&lt;/p&gt;

&lt;p&gt;Inside Rancher RKE it may look something like this in your cluster.yaml file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;services:
  kube-controller:
    extra_binds:
      - &lt;span class="s1"&gt;'/etc/localtime:/etc/localtime'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Provision your clusters with the localtime setting mounted and your jobs will be in the proper timezone.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>timezone</category>
    </item>
    <item>
      <title>NetworkManager, leave Calico Interfaces alone.</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Fri, 19 Feb 2021 18:20:27 +0000</pubDate>
      <link>https://dev.to/flrichar/netmanager-leave-calico-interfaces-alone-38de</link>
      <guid>https://dev.to/flrichar/netmanager-leave-calico-interfaces-alone-38de</guid>
      <description>&lt;p&gt;We've all been there.  You set up your nifty new Kubernetes cluster, and choose your favorite CNI, Calico, to handle networking.&lt;/p&gt;

&lt;p&gt;But then NetworkManager comes along and has to watch and interfere with all of these new virtual interfaces introduced by Calico.&lt;/p&gt;

&lt;p&gt;We can tell NetworkManager to ignore these interfaces by making the new file...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/etc/NetworkManager/conf.d/calico.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;... and including the following content inside of it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;keyfile]
unmanaged-devices&lt;span class="o"&gt;=&lt;/span&gt;interface-name:cali&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;interface-name:tunl&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;interface-name:vxlan.calico
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now those virtual interfaces used by Calico will get ignored and will not see any interference from NetworkManager.  Of course, you can also always decide not to use NetworkManager, but this may not be practical in all environments.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>calico</category>
    </item>
    <item>
      <title>DNS Haiku with TXT Records and Terraform</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Wed, 23 Oct 2019 10:24:35 +0000</pubDate>
      <link>https://dev.to/flrichar/dns-haiku-with-txt-records-and-terraform-26pa</link>
      <guid>https://dev.to/flrichar/dns-haiku-with-txt-records-and-terraform-26pa</guid>
      <description>&lt;p&gt;Recently, I wanted to test the basic powerdns terraform provider, and whether I could write multiple TXT record entries for one name.  &lt;/p&gt;

&lt;p&gt;Hey, what do you know, it worked.  I just had little test messages in there, and decided, maybe it would be neat to put the "DNS Haiku" in a text record. I used the latest Terraform, 0.12.12.&lt;/p&gt;

&lt;p&gt;Here's my code.  Notice I changed the haiku just a little.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="c1"&gt;// don't forget to put vars in separate file&lt;/span&gt;
&lt;span class="c1"&gt;// for pdns_api_key &amp;amp; pdns_server_url&lt;/span&gt;

&lt;span class="k"&gt;provider&lt;/span&gt; &lt;span class="s2"&gt;"powerdns"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;api_key&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pdns_api_key&lt;/span&gt;
  &lt;span class="nx"&gt;server_url&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pdns_server_url&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// example of multiple TXT records for name&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"powerdns_record"&lt;/span&gt; &lt;span class="s2"&gt;"text"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;zone&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"geexology.org."&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"text.geexology.org."&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"TXT"&lt;/span&gt;
  &lt;span class="nx"&gt;ttl&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;900&lt;/span&gt;
  &lt;span class="nx"&gt;records&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;It's not DNS.&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;There's no way it's DNS.&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Oh no, DNS.&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example tfvars.tf.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="c1"&gt;// cat tfvars.tf &lt;/span&gt;

&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"pdns_api_key"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"current api key"&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"notrealzlolputyourkeyheresilly"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"pdns_server_url"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"current api url"&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"http://127.0.0.1:8087"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reply from the server for the dig query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 &amp;lt;&amp;lt;&amp;gt;&amp;gt; txt text.geexology.org @172.29.100.102
;; global options: +cmd
;; Got answer:
;; -&amp;gt;&amp;gt;HEADER&amp;lt;&amp;lt;- opcode: QUERY, status: NOERROR, id: 22695
;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1680
;; QUESTION SECTION:
;text.geexology.org.            IN      TXT

;; ANSWER SECTION:
text.geexology.org.     900     IN      TXT     "It's not DNS."
text.geexology.org.     900     IN      TXT     "There's no way it's DNS."
text.geexology.org.     900     IN      TXT     "Oh no, DNS."

;; Query time: 76 msec
;; SERVER: 172.29.100.102#53(172.29.100.102)

;; WHEN: Wed Oct 23 06:19:43 EDT 2019
;; MSG SIZE  rcvd: 134

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When refreshing state, or performing &lt;em&gt;terraform plan&lt;/em&gt; the id looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;powerdns_record.text: Refreshing state... [id=text.geexology.org.:::TXT]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>terraform</category>
      <category>showdev</category>
      <category>dns</category>
      <category>jokes</category>
    </item>
    <item>
      <title>Nested, Muxed, Screens on the CommandLine</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Sun, 13 Oct 2019 13:47:12 +0000</pubDate>
      <link>https://dev.to/flrichar/nested-muxed-screens-on-the-commandline-1215</link>
      <guid>https://dev.to/flrichar/nested-muxed-screens-on-the-commandline-1215</guid>
      <description>&lt;p&gt;I'm a huge fan of the command line and always have been.  If you're like me, you're most comfortable at the keys in a dark terminal session.  Most of my day to day work can get accomplished through a terminal, with the rare case of needing a graphical web browser.&lt;/p&gt;

&lt;p&gt;As both a network engineer and systems admin, I have a lot going on at any given time.  There are two tools I believe we all use, stuff happening in the background, and an organized classification of our work areas, often times separated.  &lt;/p&gt;

&lt;p&gt;This is a good way to classify projects, environments, testing, coding, you name it.  Each workspace has it's own separation.  I'm often logged into dozens of servers, iot devices, lab machines, vms, cloud instances.  It helps to stay organized.&lt;/p&gt;

&lt;p&gt;And I'm not going to log into these resources everytime I swap client machines I'm working behind.  I could be using a linux machine, a chromebook, a windows laptop, bastion host, or temporary container. I need stuff to continue to run in the background.&lt;/p&gt;

&lt;p&gt;This is where GNU Screen comes in.  I've used it for years.  How to use screen is a bit out of the scope of this post, but the quick description is that it's a terminal muxer.  It takes one ssh session and creates a back-end of many sessions.  You can disconnect and leave them running, move to a different client, and re-connect later.  This is great for long-running processes like compiling or creating stacks or container environments.  Commands are based on a hot-key "ctrl-a".  For example, to switch to the next screen session, "ctrl-a n".&lt;/p&gt;

&lt;p&gt;Now somewhere on the internet, there's a holy war raging.  There are people who prefer tmux, an alternative to GNU screen.  Each has their own pros and cons, and for a while I switched from exclusively screen to exclusively tmux.  But wait, these are open source tools, can't I use both?  The hot-key for tmux is "ctrl-b" and some of the commands overlap.  Ie, next-session in tmux is "ctrl-b n".&lt;/p&gt;

&lt;p&gt;The diagram shows my new setup.  Tmux handles my groups. Screen handles my sessions inside those groups.&lt;/p&gt;

&lt;p&gt;Typically I use up to nine sessions in each screen session, so this allows me to have eighteen sessions muxed into one, grouped into two groups.  I've found a more comfortable working number is somewhere between 12-15.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ExmJXfNg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wgfhaji8qiul66qkzcpi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ExmJXfNg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wgfhaji8qiul66qkzcpi.png" alt="my screen nested tmux layout" width="756" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is just the tip of the iceberg when it comes to tools.  Don't even get me started on mosh, the mobile shell which uses protocol buffers (from Google) to resume roaming sessions.  &lt;/p&gt;

&lt;p&gt;[Update]: I've been using the same tmux-start script for a while, and roughly 23 sessions (20 screens + 1 more tmux group with 3 panes). I was comfortable, so automated it a bit.&lt;/p&gt;

&lt;p&gt;I have also added it &lt;a href="https://gist.github.com/flrichar/bfe95d130d980b9f279dd9d8ed388ed6"&gt;as a gist here&lt;/a&gt;, please ignore my joke about it exploding everything, but seriously you should completely understand things you find randomly on the internet, before running.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Show me your Bash Functions / Aliases!</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Sat, 21 Sep 2019 23:19:11 +0000</pubDate>
      <link>https://dev.to/flrichar/show-me-your-bash-functions-aliases-1gjd</link>
      <guid>https://dev.to/flrichar/show-me-your-bash-functions-aliases-1gjd</guid>
      <description>&lt;p&gt;Do any of you have your favorite bash functions or aliases?  I've always been a fan of quick "lightning tips" that you can show maybe on one line, and do something specific.  &lt;/p&gt;

&lt;p&gt;Here are some of mine!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="c"&gt;## timestamp dmesg with the current date, this sudo doesnt require password&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;datemsg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'date | sudo tee /dev/kmsg'&lt;/span&gt;

&lt;span class="c"&gt;## how many ms since the epoch?&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;epocms&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'date +%s%3N'&lt;/span&gt;

&lt;span class="c"&gt;## ksm is kernel same-page merging for virtual machines,&lt;/span&gt;
&lt;span class="c"&gt;## this allows me to keep tabs on performance and metrics&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;ksm-info&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'~/opt/ksm-info.sh'&lt;/span&gt;

&lt;span class="o"&gt;(&lt;/span&gt; ksm-info is just a one-liner ...
&lt;span class="k"&gt;for &lt;/span&gt;ki &lt;span class="k"&gt;in&lt;/span&gt; /sys/kernel/mm/ksm/&lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$ki&lt;/span&gt;&lt;span class="s2"&gt;: "&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="nv"&gt;$ki&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
...&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;## normal mutt is gmail, mm == local mail&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;mm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'mutt -f ~/Mail/fredr'&lt;/span&gt;

&lt;span class="c"&gt;## python pretends to be jq sometimes&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;pj&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'python -m json.tool'&lt;/span&gt;

&lt;span class="c"&gt;## run a lot of ansible playbooks ... plans == play ansible&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;plans&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'ansible-playbook'&lt;/span&gt;

&lt;span class="c"&gt;### .bashrc functions&lt;/span&gt;

&lt;span class="c"&gt;## check on kernel entropy for ssh, vpn, encryption&lt;/span&gt;
entropy &lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;cat&lt;/span&gt; /proc/sys/kernel/random/entropy_avail&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;## pipe colorfied jq to less while keeping colors&lt;/span&gt;
jql &lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; jq &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt; | less &lt;span class="nt"&gt;-R&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Many other minor stuff too, like loading environment vars for Go or BC.&lt;br&gt;
So what are some of yours?&lt;/p&gt;

</description>
      <category>linux</category>
      <category>bash</category>
      <category>showdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Organization, Classification of your personal data</title>
      <dc:creator>Fred Richards</dc:creator>
      <pubDate>Fri, 12 Jul 2019 11:21:26 +0000</pubDate>
      <link>https://dev.to/flrichar/organization-classification-of-your-personal-data-1ben</link>
      <guid>https://dev.to/flrichar/organization-classification-of-your-personal-data-1ben</guid>
      <description>&lt;p&gt;I was having a quick chat with my brother recently.  See, I've been into IT and technology for as long as I can remember.  A lot of what we do is about organization of data.  How do you think about data, how is it visualized inside your head, in your thoughts?&lt;/p&gt;

&lt;p&gt;One of the things I recommend is to create conventions for classification.  And this goes for everywhere, not just in code, or on servers, but your own local workstations as well.&lt;/p&gt;

&lt;p&gt;One of my favorite conventions is topic or type, and date.  My backups look like directories of the same type of file sorted by year.  If I moved in 2016, and scanned everything into PDF files, that's a super-quick way to find it.&lt;/p&gt;

&lt;p&gt;Same thing goes for my chrome bookmarks.  Chrome allows you to bookmark all your current tabs.  I have a special group called Stamped, where the current tabs I was concentrating on at the time are in Year-Month-Day format.  I can tell you on 20140521 what I was reading, or focused on because the history is all there.  You get a holistic view of what your thoughts were at the time, where you've gone from there, how you've grown, and maybe some topics you've dropped on the floor, for whatever reason.&lt;/p&gt;

&lt;p&gt;This one seems silly, but it's worked for me for years.  I know the vast majority of people with a coding skill set probably have a good handle on their own conventions.  What ones do you use, any unique ones? And why?&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
