What Is The Difference between a Kubernetes Service, the Kubelet, and the Kubernetes API?

Question
You know of different Kubernetes components: the Kubernetes Service, the Kubelet, and the Kubernetes API.  What do these components do and how are they different?

Answer
A Kubernetes service is an entity, that may span nodes, that keeps a group of Pods functional and coherent (paraphrased from this site).  A "[s]ervice will get its own IP address and port" as quoted from page 339 of Kubernetes in Action.  The IP address that they get is not actually pingable; this was also taken from page 339 of Kubernetes in Action. To learn more about a service, you can see this posting.

The Kubelet manages the Pods and the underlying containers running on the worker nodes (as contradistinguished from the master nodes).  (To read more, see page 326 of Kubernetes in Action.)

"The kubelet is the primary “node agent” that runs on each node. The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn’t manage containers which were not created by Kubernetes." This quote was taken from Kubernetes.io.

The Kubernetes API resides on the master node(s) to interact with the Kubelet on various nodes.  If you run programs that invoke the Kubernetes API, it will execute operations via the Kubelet running on the nodes.  (To read more, see page 326 of Kubernetes in Action.)

To learn more about Kubernetes, you may want to purchase a book on the subject other than the one cited above.

What Is The Difference between kubeadm and kubectl?

Problem scenario
Both kubeadm and kubectl are tools and commands for Kubernetes.  What are the differences between them?

Answer
kubeadm is for creating new Kubernetes clusters (as paraphrased from this Kubernetes.io page).  The command can be used to create both master nodes as well as worker nodes (taken from pg 575 Kubernetes in Action).

kubectl is for running operations on one or more existing Kubernetes clusters (as paraphrased from this Kubernetes.io page).

If you want to learn more about Kubernetes, you may want to purchase a book on the subject.

How Do You Pronounce Nagios?

Problem scenario
You have heard different pronunciations of Nagios.  How do you pronounce it?

Solution
Four of the first seven pronunciations found here support the pronunciation of Nagios with a hard "g" not a soft "g" (like a "j" sound).

This external link suggests the hard "g" is correct.

We believe that Ethan Galstad pronounces it with a hard "g."

How Do You Fix the Problem When You Get “docker command not found”?

Problem scenario
Docker is installed as far as you can tell on your Linux server.  You ran "sudo apt-get -y install docker" and it seemed to work.  When you run it again you see this:

"Building dependency tree
Reading state information... Done
docker is already the newest version (1.5-1+b1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
"

How do you get Docker to work when it seems installed but you get the error "docker command not found"?

Solution
If you have access to the internet, run this command:
sudo curl -sSL https://get.docker.com/ | sh

There are other ways of install Docker.  You may want to find a link below that is relevant to your situation:

How To Install Docker on an AWS Instance of RedHat Linux  (These directions use CentOS packages.)
How Do You Install Docker on an AWS Instance of RHEL?  (These directions use RHEL packages.)
How To Install Docker on an AWS Instance of SUSE Linux?
How To Install Docker on an AWS Instance of Ubuntu  (These directions do make changes to the Debian package repositories of your Linux server and use dockerproject.org and Ubuntu.com for the installation media.)
How Do You Install Docker on an AWS Instance of Ubuntu?  (These directions do not make changes to the Debian package repositories of your Linux server.)
How Do You Install Docker-Compose on a Linux Server?
How Do You Install Docker on a RHEL VM in Azure?
How Do You Install Docker on a GCP VM Running RHEL?
How Do You Install Docker on Debian 9 in GCP?

How Do You Find the Subscription ID for an Azure Account?

Problem scenario
You want to find the subscription ID for your Azure account.  What do you do?

Possible Solution #1
Log into the Azure Portal.  In the upper right click on your account and then click on "My permissions."  You should see an alphanumeric string near your subscription.

Possible Solution #2
Prerequisite

If you have Windows 7 you need to install Azure PowerShell; if you need assistance with this, see this posting.  If you have Windows 10, you need to install the modules for Azure; if you need assistance with this, see this posting.

Procedures
Run this PowerShell script:

Login-AzureRmAccount;
$subscriptions= Get-AzureRmSubscription
$totalvar = "The subscription ID is $subscriptions"
echo " "
echo $totalvar

Possible Solution #3
if you are using the Azure CLI, you can run this command to get the subscription ID:

az account show --query "{subscriptionId:id, tenantId:tenantId}"

How Do You Delete a CloudFormation Stack with the AWS CLI?

Problem scenario
You deployed servers with CloudFormation.  You know the name of the stack.  How do you delete the stack with the AWS CLI?

Solution

Prerequisite
This assumes you have installed and configured the AWS CLI.  If you need help with this, see this posting.

Procedure
Run this command (but replace "continualstack" with the name of the stack that you want to delete:
aws cloudformation delete-stack --stack-name continualstack

How Do You Copy All the Files in a Given Subdirectory and Place Them into a New .tar.gz File?

Problem scenario
You want to make copies of every file in a subdirectory and create a single .tar.gz file.  What do you do?

Possible Solution #1 (the files with the full path aka directory tree they are in)
Run this command: tar -czvf archive.tar.gz /path/to/source/files/subdirectory/

The above command will take a copy of all the files in /path/to/source/files/subdirectory/ and create a single file that is compressed with those copies.  It will copy the full path too.  That is, when you decompress the files in a given directory (e.g., tmp), it will look like this:

/tmp/path/to/source/file/subdirectory/

All the files will then be in subdirectory.

Possible Solution #2  (just the files and no directories)
If you do not want the underlying subdirectory tree, then change directories to be in the subdirectory with the files and run this command:

tar -czvf archive.tar.gz .

# The above command will create a file called archive.tar.gz with all the files in the current directory with no directory path structure.  This may be more desirable.

How Do You Write a Groovy Program to Read in User Input from the Keyboard and Print It Out?

Problem scenario
You want to test out Groovy as a scripting language.  You want a Groovy program to read in user input and print it out to the screen.  How do you do this?

Prerequisite
This assumes that you have already installed Groovy on a Linux server.  If you are running a Red Hat derivative (e.g., CentOS, RHEL, or Fedora), click on this link.  If you are running an Ubuntu or Debian distribution, click on this link for Groovy version 1 and this link for version 2.  If you are using Ubuntu Linux in AWS, click on the version 1 link (because the other directions won't work, and the version 1 link will actually install version 2).

Solution
1.  Create a file called input.groovy with the following two lines:

def input = System.console().readLine 'Please provide some input: '
println "You entered $input"

2.  Run it like this:  groovy input.groovy

How Do You Unprotect a Git Repository That Is in a GitLab Project?

Problem scenario
You have a Git repository that is protected in a GitLab project.  You want to allow developers to upload code directly to the master branch (not alternative branches).  What do you do?

Solution
It may be more advisable to work with a branch of a git repository.  This is a basic solution for testing or those instances when you want to work directly with the master branch.  

1.  Log into the web UI for GitLab.  
2.  Click on the Project that has the repository you want.
3.  On the left click on "Settings".
4.  Click on "Repository" under "Settings."  
5.  For "Protected Branches" click "Expand".
6.  Find the orange "Unprotect" button.
7.  Click "OK" to the prompt about "Branch will be writable for developers. Are you sure?"

While the above should work for GitLab on any type of server, if you need to reinstall GitLab on an Ubuntu or Debian Linux server, see this posting.

How Do You Pronounce quay.io?

Problem scenario
You are interested in the quay.io to store Docker images. You do not know how to say the term "quay" as in "quay.io." How should it be pronounced?

Answer
The word "quay" is pronounced "kway" (rhymes with stray). (The pronunciation "key" may be acceptable too.) If you want to see the source, click on this external page:
https://developers.redhat.com/blog/2019/06/26/using-quay-io-to-find-vulnerabilities-in-your-container-images/