How Do You Troubleshoot “Warning FailedScheduling … default-scheduler no nodes available to schedule pods”?

Problem scenario
You are running EKS in AWS. You get this message “Warning FailedScheduling … default-scheduler no nodes available to schedule pods”. How do you troubleshoot it?

Solution
Verify your nodes are healthy with this command: kubectl get nodes

If you are using EKS, you may need to create nodes. Here is a command to do that (but replace “foo” with the name of the EKS cluster that you have,

What Is The Watch Mechanism in Kubernetes?

Question
What is the “watch mechanism” in Kubernetes?

Solution
A notification system from the API server to trigger changes in Kubernetes. In Kubernetes there are observable events. The watch mechanism is a system for listening for specific events to respond to. The Kubelet, the Scheduler, the kube-dns pod, and individual controllers are components that use the watch mechanism. The API server is a central component that watching components are aware of.

Why Is There an Apparent Difference Between “docker run” and the Series of Two Commands “docker create” And “docker start”?

Problem scenario
When you run “docker run“, the container has a port that is exposed and the web application works properly.  When you use “docker create” then “docker start“, the service is not exposed properly. You believe that “docker run” the same as a series of two steps, first “docker create” then “docker start“.

How Do You Troubleshoot Kubernetes when the Pods Are Not Working Correctly?

Problem scenario
You deployment Kubernetes. You used “kubectl create” to deploy some pods. Pods are not getting IP addresses and the status is Pending. What do you do?

Solution

  1. Run a command like this (but replace “foobar” with the namespace of the Kubernetes pods you are trying to troubleshoot):

kubectl get all -n foobar

  1. The above command should list relevant deployment names or pod names.

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 Use Terraform and Kubernetes in a Simple Way (as a Proof of Concept)?

Problem scenario
You want to use Terraform and Kubernetes (in EKS). How do you do this in a simple way to test it out?

Solution
Prerequisite

This assumes you have deployed EKS. If you need assistance, see this posting.
This assumes you have installed Terraform. If you need assistance, see this posting.

Procedures

  1. This first step is optional.

How Do You Fix the AWS CLI Error “Following required service principals [eks.amazonaws.com] were not found in the trust relationships”?

Problem scenario
You run an AWS CLI command, but you get this error:

An error occurred (InvalidParameterException) when calling the CreateNodegroup operation: Following required service principals [eks.amazonaws.com] were not found in the trust relationships of clusterRole arn:aws:iam::12345678910:role/foobar

How do you fix this?

Solution
Draft a command like this (but replace “12345677810:role/foobar” with the equivalent string in the error,

How Do You Get conjure-up To Provide an Option for AWS, Azure or GCP when Deploying Kubernetes?

Problem scenario
You run “conjure-up kubernetes”, but on the page “Where would you like to deploy?” you do not see an option for AWS, Azure, or GCP (Google Cloud Platform).

You see options for maas, openstack, and vsphere. But the public cloud options are missing. What should you do?

Solution
With newer versions of conjure-up, you need to first configure a public cloud.

What Are Some Common kubectl Commands?

Problem scenario
You want to know about some common kubectl commands. What should you do?

Solution
The below was taken from running “kubectl help”. Here are some kubectl commands:

Basic Commands (Beginner):
create Create a resource from a file or from stdin.
expose Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
run Run a particular image on the cluster
set Set specific features on objects

Basic Commands (Intermediate):
explain Documentation of resources
get Display one or many resources
edit Edit a resource on the server
delete Delete resources by filenames, …

How Can Kubernetes Allow for Traffic to Non-Kubernetes Resources?

Problem scenario
You have a Kubernetes cluster, and you need some applications to access external websites. How do you do this?

Solution
Use an Ambassador. It is a sidecar that is designed to reach services (e.g., URLs or sockets) outside the Kubernetes cluster. If the external IP address changes, you just need to change it in the Ambassador containers. A convenient single-source of truth is maintainable.