How Do You Set up Nginx as an HTTP Load Balancer for Other Instances of Nginx Running in Docker?

Problem scenario
You have many Docker containers running Nginx.  You want to leverage these instances for users to go to one web site and then be automatically routed to different underlying Nginx instances in Docker containers.  How do you create a single website for web clients to go to with a reverse proxy balancing the load behind-the-scenes?

Solution
Overview
We accomplish an example with four Docker containers each using a free version of Nginx. 

How Do You Set up Nginx as an HTTP Load Balancer So Client Requests (from Web Browsers) Go to Certain Nginx Servers More Frequently Than Others?

Problem scenario
You have certain Nginx servers with ample resources whereas others have minimal resources.  Based on geographic locations and data center bandwidth locations and costs, you want to assign fractions of the web traffic from client workstations (requests from web browsers) to different Nginx servers more than others.  You do not want round-robin, equal distribution of traffic.  You want customized HTTP load balancing in accord with unequal configurations.  How do you distribute this traffic proportionately according to your desired specifications?

How Do You Troubleshoot The Linux Error “Failed to execute operation: Invalid argument”?

Problem scenario
You try to enable a service with this command: sudo systemctl enable foobar

But you get this error: “Failed to execute operation: Invalid argument”

What should you do?

Solution
1. Find the .service file for foobar (e.g., /etc/systemd/system/foobar.service).
2. Find the “Install” section. Is there an extra character? Make sure the line looks right.

How Do You Delete a Kubernetes Cluster in AWS?

Problem scenario
You try to manually delete EC-2 instances (both worker nodes and the master node of Kubernetes), but this does not work. The EC-2 instances are re-created. How do you delete the cluster?

Solution
Prerequisite
Install and configure the AWS CLI; if you need assistance, see this posting.

Procedures
Run these three commands but substitute “contint.k8s.local” with the name of your cluster:

export KOPS_CLUSTER_NAME=contint.k8s.local
export KOPS_STATE_STORE=s3://$KOPS_CLUSTER_NAME-state
kops delete cluster –name contint.k8s.local –yes …

How Do You Find The Web UI Credentials for Foreman after You Installed It?

Problem scenario
You want to log into the web UI of Foreman. What do you do?

Solution
1. Run this command: sudo find / -name foreman-installer -type f
2. Based on the results above, run this: sudo /path/to/foreman-installer –foreman-version # Replace “path/to” with the results of the first command (e.g., /usr/sbin/”).
3. The output from the above command should show you the credentials for the administrator user.

How Do You Know What Version of Foreman Is Installed?

Problem scenario
You inherited a server with Foreman installed. What should you do to find out what version is installed?

Solution
1. Run this command: sudo find / -name foreman-installer -type f
2. Based on the results above, run this:
sudo /path/to/foreman-installer –foreman-version

# Replace “path/to” with the path results of the first command (e.g., /usr/sbin/”).