Share something you learned (November)


#1

Rules:
1/ Reply with:

a sentence
a paragraph
some code
some notes
OR a link to a blog post, Github repo, or codepen
… describing something you learned, or featuring something you accomplished
2/ Share something regularly!

3/ Anyone can participate

4/ You can post new learnings throughout the month.


#2

I learned how to update DNS records stored in AWS Route53 from within an application. Code available at: github.com/billglover/localname/cmd/client.

Things that I discovered:

  • There isn’t a way around providing the HostedZoneID as a configuration option. I was hoping just to provide the domain name.
  • When you update a DNS record in Route53 you make a request for the update, the update happens some time later. If you are interested in knowing whether it was successful or not you need to poll for status changes.

This code forms part of a small application that watches for changes in my external IP address and then updates a DNS entry to point to the new address. I intend to use this a way to get external access to services hosted on my home network.

Next steps: Build Docker container images, deploy to a Raspberry PI that I keep running.


#3

Continuing from yesterday, I now have a Docker container that will monitor for external IP address changes and update a domain name to point to the IP. A screenshot of it in action is below. I can’t explain the errors that appear but this only seems to happen when toggling a VPN connection on/off to force an IP change.

The thing I learned today was how to deploy this to a Kubernetes cluster. I learned that secrets can be presented as environment variables and or mounted as files in a volume inside your container. Although I’d prefer to use mounted files, I opted to use environment variables with this application as I know how to access them.

This is an example of how you define secrets for Kubernetes. I can then reference these from within Pod specifications to map them into containers.

apiVersion: v1
kind: Secret
metadata:
    name: localname
type: Opaque
data:
    domain: bXlpcC...AIDj8udjSJ7m1l
    zoneID: WjF...HDK93FKQME4=
    freq: M...sjs9KDh6z
    awsKey: QUtJQ...HMlE=
    awsSecret: VkpmbHDK7dK890SHG...Rd29Id1EzTQ==

The screenshot below shows this deployed on a Raspberry Pi Kubernetes cluster. Hopefully next time my broadband connection changes IP address, I should see my domain name update to reflect the change.

Apologies to anyone who joined the co-working hangout, I had to keep turning off the screen-sharing when working with secrets files.

Update: I’ve just restarted my broadband router and the update took a couple of minutes to come through. This is exactly what I need and I can now decommission all the 3rd party dynamic DNS services I had been trying to use.


#4

Today I learned that Helm is not available for Arm. This is a little frustrating but I may be able to compile a copy myself.

Context to this is that I’m deploying all the personal projects I complete onto a Raspberry Pi Kubernetes cluster in an attempt to familiarise myself with basic Kubernetes tasks. The Raspberry Pi uses an AMD CPU and so does not run software compiled for AMD64, the instruction set supported by the majority of CPUs underneath Kubernetes clusters.


#5

Today I learned that it’s best to remove power from stepper motors once they’ve reached their intended position. Keeping the power applied locks then position but draws a significant current to do so. The motors tend to get quite hot when locked in this idle position.

I’d not considered this at all, but powering down the circuitry when not moving seems to have no side effects and keeps things a lot cooler.

In other news… my C isn’t what it once was.