How Do You Install kubelet on Any Type of Linux?

Problem scenario
You want a quick, generic way to install kubelet on any type of Linux.  What should you do?

Solution
Run these commands:

cd /tmp

curl -Lo kubelet https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubelet && chmod +x kubelet

sudo mv kubelet /usr/bin/

Test it by running this command: kubelet –version

(If you would prefer to use apt commands,

How Do You Fix a .service File for systemctl Commands to Work?

Problem scenario
You have a bash command that works reliably. But when it is in a .service file (e.g., the ExecStart stanza) the corresponding systemctl command with systemctl start fails. You have tried putting quotes around the arguments in the ExecStart stanza. Using your .service file with systemctl almost works; but there is an unlogged failure that you do not expect. The service (e.g., Logstash or some other service) fails quickly.

How Do You Secure a Docker Container, a Docker Host, and Their Network?

Problem Scenario
You have been tasked with finding ways of securing Docker containers, a Docker host, and your network that has Docker containers.  How do you harden a Docker container and its related infrastructure (i.e., the Docker network and Docker host)?

Solution
Overview

From a pragmatic perspective we understand that there are exceptions to the recommended practices.  (Not the least of which is the rapid rate that technology changes.)  The assertions below are recommended practices. 

How Do You Troubleshoot a Python Error “UnboundLocalError: local variable ‘x’ referenced before assignment”?

Problem scenario
You run a Python program but you get this error: “UnboundLocalError: local variable ‘x’ referenced before assignment”

Solution
Root Cause

You have a function in Python and it refers to a previously assigned variable.  This variable was not passed as a parameter.

Procedures
You need to redeclare (but not necessarily reassign) the variable as a “global”. 

How Do You Delete VM Instances from GCP That Pertain to GKE?

Problem Scenario
You have some GKE standard clusters that you want deleted.  What should you do?

Possible Solution #1 (from the Cloud Shell or with a gcloud command)
1.  Delete the instance group of the instance for the cluster you want to delete.  To do this in the web UI, go to Compute Engine -Instance Groups.  Check the box on the left-hand side and click on “Delete”.

How Do You Write a Tic-Tac-Toe Program in Groovy?

Problem scenario
You want to code a Groovy 2.x program.  You want a program that reads user input, prints out processed output, uses closures (similar to functions in other languages) with and without return statements, handles some exceptions (non-standard input or input that is no longer valid based on what was previously entered), and uses classes.  How do you write a Tic-Tac-Toe (aka naughts and crosses) program in Groovy that has the above things?

How Do You Invoke a class in a Groovy Program?

Problem scenario
You have a Groovy with these lines of code:

class Contint {
   static void main(String[] args) {
      def apple = {println “This is a basic test.”};
      apple.call();
   }
}
println “This is the second print statement in the code.”

The “Contint” class is never invoked.  What should you do?

Solution
Overview

You need to use the “new” reserved word.  This will instantiate the class. 

How Do You Connect to a Windows VM in Azure?

Problem scenario
You created a Windows VM.  But you cannot ping it or connect to it with RDP.  What do you do?

Solution
1.  In the Azure portal web UI, click on the NSG (Network Security Group) protecting the VM. 
2.  Add a rule. 
3.  Click the “Advanced” button so you are able to add an IP address source for the rule. 
4.  From your workstation,

How Do You Create a Logic App without Using the Azure Portal Web UI?

Problem scenario
You want to create a Logic App without using the Azure Portal web UI.  What should you do?

Possible Solution #1
To get an overview of using an ARM template for a Logic App, you should read this article.

Possible Solution #2
If you have Visual Studio, you can use the Azure Logic Apps Tool for Visual Studio.