Is there a Docker Hub equivalent for OpenShift?

Problem scenario
Docker Hub is a public registry for containers. Does OpenShift support something like this? You know they have the OpenShift Container Registry — but this is private to a given OpenShift instance. Red Hat owns OpenShift. Is there a public registry supported by Red Hat?

Answer
Yes. It is called Quay.io. If you want a brief overview of it,

 » Read more..

How Do You Find the kubectl Version Your Kubernetes Server Is Running?

Problem scenario
You know the kubectl version that is running on your client machine. How do you determine the version that your Kubernetes master node is running?

Solution
From the client machine, run this command: kubectl version | grep Server

 » Read more..

How Do You Create a Customer Managed Key in AWS?

Problem scenario
You want to create a CMK in Amazon web servers. What do you do?

Solution
Use Secrets Manager with Amazon’s Key Management Service.

1. Log into the AWS console.
2. Go to “Key Management Service”
3. Click on “Create key”
4. Enter an “Alias”. Normally you won’t click on the “Advanced options” unless you have a special reason.

 » Read more..

How Do You Extract a File from a .zip File without unzip?

Problem scenario
You have a .zip file, on your Linux server, that you want to uncompress. You do not have unzip installed on your machine. What should you do?

Possible Solution #1
Install unzip. If you are using a Debian/Ubuntu distribution of Linux, run this: sudo apt -y install unzip

Possible Solution #2
You could use WinSCP to download the file to your Windows workstation.

 » Read more..

How Do You Find Where the Python Interpreter Will Look for Modules?

Problem scenario
You want to use custom modules (e.g., .py files that will be called by another Python program). You are trying to figure out which location(s) the Python interpreter will look for such modules. How do you determine the directory where Python will look when it uses the “import” key word?

Solution
Run these three commands (the first is a Bash command and the other two are Python):

python
import sys
print(sys.path)  » Read more..

How Do You Troubleshoot the Python Error “subprocess.CalledProcessError: Command ‘…’ returned non-zero exit status 1”?

Problem scenario
You are automating a Linux infrastructure task with Python using subprocess calls. You get this error “subprocess.CalledProcessError: Command ‘…’ returned non-zero exit status 1”, what should you do?

Solution
Run the Linux command without Python. Then run echo $? to determine the exit code. If you see a 1, that means Python notices this command is not considered to have run successfully.

 » Read more..

What Should The Permissions of the kubectl File Be on a Linux server?

Problem scenario
You copied the kubectl file. You are not sure what the permissions it should have. When you try to execute it, you get “Permission denied”. What should you do?

Solution
We recommend using this: sudo chmod 777 kubectl

When you use conjure-up, it makes kubectl have 777 permissions. We find this to be a reasonable standard that works.

 » Read more..

How Do You Change the Time Zone on an Ubuntu or Debian Linux Server?

Problem scenario
You are running Debian or Ubuntu Linux. You use the date command and find an incorrect time zone. What do you do to correct it?

Solution
Run this command: sudo dpkg-reconfigure tzdata

 » Read more..

In AWS’ KMS What Is the Difference between Administrative Permissions and Usage Permissions of a CMK?

Question
A CMK is an encryption key. In Amazon Web Services, for CMKs (Customer Managed Keys) in KMS (Key Management Service), what is the difference between administrative permissions and key usage permissions?

Answer
Usage permissions enable (either IAM users or roles) to encrypt and decrypt data with the AWS KMS API.

Administrative permissions for a CMK allows either an IAM user or role to give usage permissions to other IAM users or roles through the API (and sometimes the web console).

 » Read more..

How Do You Retrieve an Application-Level Secret from AWS?

Problem scenario
You want to obtain a non-database secret from AWS and you know the name of the secret (in Secrets Manager) and the region it is in. What should you do?

Solution
Prerequisites
You have installed and configured the AWS CLI. If you need assistance with this, click on this posting if you can use pip or this posting if you cannot use pip.

 » Read more..