How Do You Terminate Pods in Kubernetes?

Problem scenario
You have some Pods in Kubernetes that you want deleted. What should you do?

Solution
1. Find the names. You can run this to find out: kubectl get pods

2. Run this command, but replace “foobar” with the name of the pod you want deleted: kubectl delete pods foobar

3. That should be it. Run kubectl get pods to verify deletion was successful.

How Do You Troubleshoot the Java Program Message “java.sql.SQLException: No database selected”

Problem scenario
Your Java program returns this message: “java.sql.SQLException: No database selected”
What should you do?

Possible Solution #1
Your SQL statement was appropriate for a database but not for the circumstance of connecting to a SQL instance. Try show databases; instead of the SQL you were running.

Possible Solution #2
Did you connect to the SQL instance you thought you connected to?

How Do You Get a List of Mail Queue IDs and Nothing Else?

Problem scenario
You use the mailq command. You see several emails have timed out. These emails are essentially in an “outbox” and a future delivery attempt is in the near future. How do you produce a list of the mail queue IDs by themselves?

Solution
If you want a list of the mail queue IDs in the queue, run this:
mailq | awk ‘{print $1}’ | grep -v ‘[[:punct:]]’ | sort | uniq

How Do You Troubleshoot the Error “sed: -e expression #1, char 1: unknown command: `””?

Problem scenario
You have a sed command in a script, but you get an error like one of the following:

sed: -e expression #1, char 1: unknown command: ” sed: -e expression #1, char 1: unknown command:”‘

How do you troubleshoot this?

Solution
You may need to assign variables like this:

var1=” foo””‘”” bar” # Place quotes around any unusual characters (e.g.,

How Do You Run a Java Program to Run SQL Commands Against a MySQL Database?

Problem scenario
You have a MySQL database. Rather than use a SQL front-end application, you want to write a Java program that will run a SQL statement against the database. What should you do?

Solution

1. Install the Java compiler if it is not already installed. If you need assistance, see this posting.

2. Run this command:
curl -Lk https://www.javatpoint.com/src/jdbc/mysql-connector.jar >

How Do You Troubleshoot a Docker Container Supporting a Web Service That Web Browsers Cannot Seem to Reach?

Problem scenario
You have configured a Docker container with a web service (e.g., Apache web server or Nginx).  You configured the listening, external port to be 80 or a different port number.  You find the web server (either Apache or Nginx) is not working from a web browser.  How do you find what is wrong?

Solution
#1  Use nmap to test the port and IP address. 

Why Cannot You Ping a Server when Nmap Commands to The Server Work?

Problem scenario
You cannot ping a server, but your nmap results show that port 22 on the server is open. You can reach the server with nmap, but not with ping. What is wrong?

Possible solution
Is the server in the AWS Security Group that you think it is? Go to the AWS console and verify the security group for the server is what you think is correct.

How Do You Quickly Add a New Event to the Windows Logs Using PowerShell?

Problem scenario
You like adding logging messages manually in Linux/Unix. You do it from the command prompt with “# write a cool message here”. You review the messages with a “history” command. You also append messages to log files in /var/log/foorbar.d with ‘echo “note this” ‘. How do you introduce your own messages into Windows event log?

Solution
Run a command like this but change “Application” to “Security” or whichever log category you want:

Write-EventLog -LogName Application -EventId 3 -Message “Continual Integration helps!” -Source “Windows Error Reporting”

# Note that “Windows Error Reporting” is just one of several valid sources. …