What Are Common Use Cases of Daemonsets in Kubernetes?

Question
DaemonSets will bypass the scheduler and deploy to nodes that are designated as "unschedulable"; however you can use a DaemonSet to deploy to a subset of all the nodes (according to page 109 of Kubernetes in Action). In the real world, what are daemonsets used for in Kubernetes?

Answer

  • Monitoring of pods/nodes (such as Prometheus Node Exporter, New Relic, collectd, or a Datadog agent)
  • Centralized logging of pods/nodes (Splunk, Fluentd, or logstash)
  • To enable storage to be accessible for the node
  • Enabling recommended-security on nodes to authenticate with AWS. (This was taken from https://github.com/jtblin/kube2iam.)

References
https://www.bmc.com/blogs/kubernetes-daemonset/
https://cloud.google.com/kubernetes-engine/docs/concepts/daemonset
https://medium.com/kubernetes-tutorials/a-guide-to-kubernetes-daemonsets-6db7920ad140

How Do You Parse a String in Bash?

Problem scenario
You want to count the number of "(" (open parens) in a string. How do you parse a string in Bash?

Solution
Remember to use awk. The -F flag can allow you to designate a character to count and the NF flag can count the occurrences.

echo "continualintegration" | awk -F "o" '{print NF-1}'

echo "c(ntinua((lintegrati(n" | awk -F "(" '{print NF-1}'

You may also want to see this posting parse an array.

What is Knowledge of Merging Strategies in the Context of Git?

Question
What are different merging strategies in the context of Git?

Possible Answers
"...branches are completely useless unless you merge them…" - Linus Torvalds

A branch is a set of files associated with a code base usually in a collection known as a repository. Atlassian says "[b]ranching is a feature available in most modern version control systems...", and a merge is "[a] process that unifies the work done in two branches..." (as quoted from here.)

A build, release, or DevOps engineer or software developer will use code versioning tools. Merging, to reconcile different branches, can be managed by technical configurations of code versioning systems as well as enterprise procedures that may govern teammates usage of such systems.

There are multiple types of merging that happen in version control systems behind-the-scenes. Depending on how they are coded, they can use line-based, text-based, static semantic, and syntactic merging.* This article does not focus on the development of your own code version control system; this article focuses on being a user of such a software product and the strategies for branching and merging.

The develop branch (like a feature branch) collects and receives changes to the code base. At some point, this branch will be merged with the main branch.

There are different merge policies that a given code versioning system can be configured to support. For example, Azure DevOps Repos, Atlassian BitBucket, Git, etc. have built-in configurations to handle conflict reconciliation or prevent conflicts from happening.

Squash merges eliminate the history of the changes to files, and give you just the result of the changes. Microsoft's website says "[a] simple way to think about this is that squash merge gives you just the file changes, and a regular merge gives you the file changes and the commit history."

Some development teams are discouraged from a procedural perspective from doing squash merges, but your CVS may allow them to happen. Squash merging is strongly discouraged in part because of the benefits of doing diffs (examining the differences in code that was checked in if a bug was discovered). (This previous sentence was derived from a Medium.com posting.)

A merge of branches preserves the history of changes in the most recently modified branch whereas rebase undoes recent changes to make one branch identical to the source branch. (The source of this is https://betterprogramming.pub/differences-between-git-merge-and-rebase-and-why-you-should-care-ae41d96237b6.)

Rebase involves removing zero or more changes in a codebase's branch (often on a client) to make it like a repository's source branch version (often remotely in the central repository), whereas merge involves receiving and reconciling two different branches. see this StackOverflow posting.

It is hard to discretely list all possible merging strategies. In the context of using Git, there are numerous options to merging code. There are built-in options that software repositories have (e.g., for BitBucket) called "merge strategies" that are different from human techniques and policies to merge code. In theory the term "strategy" could refer to either.

Merge commits have two or more parent commits (according to this external site).

Squash commits have a non-merge commit on the target branch (according to Atlassian's website).

Rebase involves having a remote branch's changes supercede any conflicts with the local branch you are working on. (Your local repo's files can be overwritten if you rebase.)

Fast-forward merges involve a merge commit if the source branch is older than the target branch otherwise the target branch gets updated with the changes on the source branch. (The source of this is this external site.)

To learn about recursive, resolve and octopus merge strategies, see this posting. To learn more about Git merging strategies in general, see these postings:

The influential book Continuous Delivery recommends adopting a consistent merge strategy (on page 408), but this is achievable with enabling/using rebasing, fast-forward merges, squash commits, and merge commits regularly.

Sometimes changes are merged to a Git repo that were not from a branch in the repo. The term "promiscuous integration" refers to pulling from different forks of the "same" repository (according to page 81 of Continuous Delivery).

Branching strategies are closely related to merging strategies. You may want to see this posting. Trunk-based development deals with few to no branches; when you use it you would often commit code to one branch and not merge code.


* To learn more about the behind-the-scenes merging strategies, read the following:

To learn about them you could read pages 367 through 369 of Elements of Programming Interviews in python.

Text-based merging does not take into account syntax, semantics or inconsequential changes; thus failures are reported as "conflicts" are detected when there are no significant changes. (This previous sentence was paraphrased from page 368 of Elements of Programming Interviews in python.)

To learn more about line-based merging, see this article.

To learn more about semantic merging, see this PDF or page 22 of this PDF.

To learn more about syntactic merging, see page 20 of of this PDF.

Generally, there are ways of preventing conflicts, reconciling conflicts asynchronously, or addressing conflicts in someone's absence. Certain practices that support this are the following: 1) not committing binary files (as the resulting merge will be unusable or the code versioning system will use too much space). 2) Making meaningful commit messages (such as a link to a Jira or ServiceNow ticket). 3) Setting up email notification when a branch has been updated. Some individuals will want to know if there is activity on a certain branch.

For more recommendations on how to govern the code versioning system, see this.

How Do You Fix a Carrier Thermostat That Is Blinking All Lights and Not Working?

Problem scenario
Your Carrier thermostat (e.g., a programmable Comfort (TM) Series Touch-n-Go (TM)) is not working. There is a glitch or apparent malfunction on the screen. All the lights flash on with the backlight turning on -- then the display goes dark (unlit with no indication). The heating and cooling does not work. The batteries seem good; the thermostat showed them at two-thirds strength (two of three bars were strong).

The display looks like this:

Carrier Thermostat Display Example

What should you do?

Possible Solution
Try with different known-good batteries. (This solution is particularly helpful if the thermostat itself is less than five years old.) The problem may seem like the original batteries are fine, but really they are defective. One Carrier thermostat manual (that comes with three different programmable thermostat models that Carrier makes) specifically say that the batteries should be replaced when there is one bar of strength left -- not when there are no bars of strength left. We recommend replacing the batteries as soon as the battery indicator light is visible that one bar of strength is gone/blank/weak and two are dark/strong. Otherwise you may have a problem as the one described above.

How Do You Troubleshoot “mount: /foobar: must be superuser to use mount” when You Open a Terminal in Linux?

Problem scenario
When you open a terminal or log into a Linux server, you see a message like this:

"mount: /foobar: must be superuser to use mount."

You suspect some bash script is running every time you log in. What should you do?

Possible solution #1
If you are running a Red Hat server, go to /etc/profile.d/. Sort the files by time modified like this:

ls -lh --sort=time

Look for a script that is trying to mount foobar.

Possible solution #2 (more of a tip to lead to a solution):
Run this command to find the directory that is attempted to be mounted:

sudo find / -name foobar

Is the directory corrupt?

Possible solution #3 (more of a tip to lead to a solution):

df -h | grep foobar

Possible solution #4 (more of a tip to lead to a solution):

cd /
sudo grep -R foobar

Confused about Legal Policies for your Small Business?

Problem scenario
You run a website business. Where do you go to get an understanding about legal policies? You want to learn more about how to comply with Amazon's Affiliate Marketing program's policies. What do you do?

Solution
You can try termly.io for general policy information assistance. For Amazon's Affiliate Marketing program specifically, see this external posting. For the FTC's guidance that was published in March of 2013, see this external posting.

How Do You Troubleshoot Errors Such as “/lib64/libcurl.so.4: no version information available”?

Problem scenario
You try to run an obs command. You get errors like these:

var/lib/snapd/snap/obs-studio/1195/usr/bin/obs: /lib64/libcurl.so.4: no version information available (required by /var/lib/snapd/snap/obs-studio/1195/usr/bin/obs)
/var/lib/snapd/snap/obs-studio/1195/usr/bin/obs: symbol lookup error: /var/lib/snapd/snap/obs-studio/1195/usr/bin/obs: undefined symbol: obs_get_module_lib

What should you do?

Solution

  1. Back up the /lib64/libcurl.so.4 to a user's home directory (just in case).
  2. Run this:
    sudo find / -name libcurl.so.4 | grep -i obs
  3. Copy one of the files found above to /lib64/

How Do You Troubleshoot Adding Red Hat Packages with Errors Like “Curl error (77): Problem with the SSL CA cert (path? access rights?)”?

Problem scenario
You try to run a DNF command, but you get stymied with errors like these:

Fedora 32 foobar (From SomeCompany) - x86_64 0.0 B/s | 0 B 00:00
Errors during downloading metadata for repository 'fedora-somecompany-foobar': - Curl error (77): Problem with the SSL CA cert (path? access rights?) for https://mirrors.fedoraproject.org/metalink?repo=fedora-somecompany-foobar-32&arch=x86_64 [error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs]
Cannot prepare internal mirrorlist: Curl error (77): Problem with the SSL CA cert (path? access rights?)

How do you not get blocked by a problem like this?

Possible solution #1
Look at /etc/ssl/certs/ca-certificates.crt. Is it the right size? What are the permissions? Messing around with .so files and curl packages can involve accidentally deleting this file. Where can you one that you need? Run this: sudo find / -name ca-certificates.crt
Another valid one may be somewhere else on your machine.

Possible solution #2
Try to run the dnf command with sudo or as root.

Possible solution #3
Run this command (but substitute "somecompany-foobar" with what you saw in the original error message):
sudo dnf config-manager --set-disabled fedora-somecompany-foobar
Now try to run the command again.

Possible solution #4
Run a command like this:
sudo dnf -y install ca-certificates

How Do You Fix a White/Blank Web Page?

Problem scenario
You have a white screen in the web browser. Why is the website just white when using HTML?

Possible Solution #1
Are the font and background color the same? If the font is set to be white, that may be the problem. HTML has hexadecimal codes for the font and background color; you can view them here: https://htmlcolorcodes.com/

Possible Solution #2
Is there a misspelling in the URL and the ultimate web page? You may want to check the .html file's name on the back-end.

Possible Solution #3
Has the content been accidentally commented out? Is there a formatting issue or syntax problem with the HTML file itself?

Possible Solution #4
If you are using PHP, see this posting: How Do You Fix a PHP Web Page when the Page Is Completely Blank?

Possible Solution #5
Scroll down to the very bottom. The page may be very long and have content at the bottom.

Is There a Difference between an IAM Role and an IAM Access Key?

Question
Is there a difference between an IAM role and an IAM access key?

Answer
Yes. To summarize this article, IAM users are for humans and IAM roles are for AWS components (such as S3 buckets and EC-2 instances). As a less significant difference, you do not rotate IAM roles (according to this medium.com post).

An access key is like a username; it will need a secret key that is associated with it for authentication.

An IAM role associates a service in AWS (e.g., an EC-2 instance) with authorization to access various other services (e.g., S3 buckets). For typical AWS administration there would be no password associated with an IAM role. An access key would have a secret access key ID that would be needed to authenticate a user (e.g., to run some AWS CLI commands).

To learn about the difference between IAM keys and IAM roles, read this article and see this video.


(IAM keys are AWS access keys. We know this because "[a]ccess keys are long-term credentials for an IAM user or the AWS account root user." (The quote was taken from this Amazon page.)

Access keys consist of two parts: an access key ID (for example, AKIAIOSFODNN7EXAMPLE) and a secret access key (for example, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY).

https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html