How Do You Use Custom Resource Definitions in Kubernetes?

Problem scenario
You want to extend Kubernetes’ functionality. You want to use CustomResourceDefinitions. You can view API resources by running “kubectl api-resources”. You want to add to the list. How do you use a CRD?

Solution

  1. Create a file called contint.yaml with the following content:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: contintexamples.continualintegration.com
spec:
group: continualintegration.com
names:
kind: ContintExample
plural: contintexamples
listKind: ContintExampleList
singular: contintexample
scope: Namespaced
versions:
– name: v1
# Each version can be enabled/disabled by Served flag. …

How Do You Troubleshoot OOM Errors with Restarting Pods in Kubernetes?

Problem scenario
You find out-of-memory (aka OOM) errors in Kubernetes. The node seems healthy. The pods keep restarting. What should you do?

Possible Solution #1
Are you using a burstable quality of service (aka QoS) with the pods? There may be a non-pod-specific reason and the burstable Pods are being starved of resources. The node may be getting requests for other pods with a superior quality of service.

In I.T., what is a Schema?

Question
In computing, what is the definition of a schema?

Answer / schema disambiguation
Outside of the I.T. realm, Merriam-Webster’s Dictionary (11th Edition, on page 1110) defines schema as “a diagrammatic presentation; broadly: a structured framework or plan: outline.” This definition must have influenced the appropriation of the word to refer to concepts in I.T..

For Kubernetes
“Schemas are the set of JSON files for various Kubernetes versions,

How Do You Troubleshoot the Error “unable to prepare context…no such file or directory”?

Problem scenario
You run “docker-compose build” and you get this:

1 error occurred:
* unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/jane/dockercompose/webapp/Dockerfile: no such file or directory

What should you do?

Solution
Look at your docker-compose.yml file. Look at the “build” stanza. What directory is it referring to? Is a Dockerfile file in that directory?

How Do You Create a docker.service File on a Linux Server?

One of the following apply:

Problem scenario #1
You run this: “sudo systemctl start docker”
But you get this: “Failed to start docker.service: Unit docker.service not found.”

Problem scenario #2
You run this: “sudo systemctl start docker”
But you get this:
“docker.service: Service has no ExecStart=, ExecStop=, or SuccessAction=. Refusing.”
or this:
“Failed to start docker.service: Unit docker.service not found.”

Problem scenario #3
You run this: sudo systemctl enable docker
But you get this: “Failed to enable unit: Unit file docker.service does not exist.”

Solution
Use this posting.

Is Kubernetes Ending Support for Docker?

Problem scenario
You read that Kubernetes is ending support for Docker. What does this mean for Kubernetes users?

Solution
Probably nothing for most Kubernetes users. Kubernetes is going to support Open Container Initiative images.

Docker is more than a container runtime; its container runtime is containerd (according to twoardsdatascience.com). We expect containerd to be supported for a long time.

What is a Mutating Webhook?

Question
In the context of Kubernetes, what is a mutating webhook?

Answer
They are an API invocation that make changes to resources (and in some cases before they are created per medium.com).

“MutatingAdmissionWebhook is one of easiest ways of extending Kubernetes with new policy controls and resources mutation and a host of other options.” (Taken from medium.com )

“Mutating controllers may modify related objects to the requests they admit;

How Do You Solve “Error Problem with installed package …docker-ce conflicts with podman-docker”?

Problem scenario
You try to install docker-ce on a CentOS/Stream/RHEL/Fedora server, but you get an error like this:

Error:
Problem: problem with installed package podman-docker-1:3.4.1-3.module_el8.6.0+954+963caf36.noarch

package docker-ce conflicts with podmoan-docker

What should you do?

Solution
This will remove some packages. Do not do this if you have customized the packages involved.

Run these commands:

sudo yum remove buildah skopeo podman containers-common atomic-registries docker container-tools

sudo dnf -y install docker-ce …

How Do You Get Nodes in Kubernetes to Be Ready with a Network Plugin Error?

Problem scenario
Your pods are not ready in Kubernetes. “kubectl describe pods” results may have errors like this:

Warning FailedCreatePodSandBox 4m57s (x2035 over 69m) kubelet (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container “abcd1234” network for pod “apache-tomcat-deployment”: networkPlugin cni failed to set up pod “apache-tomcat-deployment” network: open /run/flannel/subnet.env: no such file or directory

(The symptoms of this problem will involve pods and nodes not being ready.