How Do You Find the Requests, Limits, and Replicas of Pods Deployed from Helm Charts?

Problem scenario
You do not have the YAML (.yml or .yaml) files for your Helm deployments.

How do you find the pod manifests for the yaml files when you do not have access to the Helm repos?

Solution
Run this:

helm ls -a -A

The output will show a “Name” on the left most column and a namespace in an inner column.

How Do You Use the AWS CLI to Return IAM Information with the AssumePolicyDocument Nested JSON?

Problem scenario
You want to craft an AWS CLI command to return the principal services of your IAM roles. You want the name and the ARN values of the roles to be printed along with the principal services. You the principal services data is in the AssumePolicyDocument. Your previous attempts have returned “None” for this value. What do you do?

Solution
Run a command like this:

aws iam list-roles –output text –query ‘Roles[*].[RoleName,Arn,AssumeRolePolicyDocument.Statement[*].Principal]’ …

How Do You Troubleshoot the kubectl ‘version “extensions/v1beta1″‘ Error Message?

Problem scenario
You run a kubectl command, but you get this problem: ‘error: unable to recognize “foobar.yaml”: no matches for kind “Deployment” in version “extensions/v1beta1″‘

What should you do?

Solution
Change your yaml file so the apiVersion setting/value works. To learn more about the acceptable values, see this posting.

How Do You Create an IAM Role in AWS to Allow for Nodegroups to Be Created in EKS?

Problem scenario
In the AWS Management Console, you cannot add a Node to an EKS cluster. The “Node IAM Role” never has any option. You click the “refresh” arrow, but all you see is “No roles found. Follow the link above to create a new role.” What should you do?

Solution

1. Install and configure the AWS CLI. If you need assistance with this,

How Do You Tell If the .yaml File for a kubectl Command Will Work?

Problem scenario
You want to do some pre-testing on the .yaml file(s) you will use with kubectl. How do you validate a .yaml file has correct syntax for Kubernetes?

Possible Solution #1
Try this command:
kubectl apply –validate=true –dry-run=true –filename=nameofyourfile.yaml

Possible Solution #2
Try this website:
https://www.kubeyaml.com/

Possible Solution #3
Try kubeval: https://www.kubeval.com/

Possible Solution #4
Use Copper: http://copper.sh/

How Do You Know the Syntax of the JSON for the –policy-document Flag for Adding Policies to a Role in AWS?

One of the following scenarios apply:

Problem scenario #1
You want to run a command like this:
aws iam put-role-policy –role-name contintdelete-role –policy-name DELETEPOLICY –policy-document file://adminPolicy.json

But you do not know the syntax of the adminPolicy.json.

Problem scenario #2
You are trying to use the –policy-document flag with the command “aws iam put-role-policy”. But you get this error:

An error occurred (MalformedPolicyDocument) when calling the PutRolePolicy operation: Syntax errors in policy.

How Do You Read a JSON File to Extract the Value of a Given Key in a JSON File?

Problem scenario
You want to print the value of a given non-nested key in a JSON value. How can Python help you achieve this?

Solution
Here is an illustrative example. Create a file called reader.py with the following lines of code:

import json
with open(“first.json”, “r”) as reading_content:
i = reading_content.read()
j = json.loads(i)
print(j[“bird”])

Have the JSON file look like this:

cat first.json

{“bird”: {“name”: “singy”, …