pull docker hub image from kubernetes

3/3/2020

I have just setup a Kubernetes/docker cluster with 2 nodes, and I would like to deploy a test image for now, I would like to try with the folding@home project.

I found the docker image in https://hub.docker.com/r/captinsano/foldingathome but I can't figure out how to load that image into K8s. I know I need to generate a yaml file but I am not sure how to proceed from there. I tried to create a yaml file with the following:

apiVersion: v1
kind: Pod
metadata:
   name: foldingAtHome
spec:
   containers:
   - name: foldingAtHome-container01
     image: captinsano/foldingathome:latest
     ports:
     - containerPort: 6379

But K8s complains about the way I referenced values in the yaml file.

kubectl create -f foldingAtHome.yml
The Pod "foldingAtHome" is invalid: 
* metadata.name: Invalid value: "foldingAtHome": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
* spec.containers[0].name: Invalid value: "foldingAtHome-container01": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')

I am not sure what I am doing wrong ? how do I get Kubernetes to tell docker to pull that image?

Thank you

-- Bluz
docker
kubernetes

3 Answers

3/4/2020

Its already there what you have done wrong. Use the small letters instead in both metadata and container name.

-- sandeep P
Source: StackOverflow

3/3/2020

Kubernetes doesn't allow capital case in meta data, because this will be used by core DNS component of kubernetes as a DNS of your service. Change the name to lower case and it should work fine.

-- Mr Kashyap
Source: StackOverflow

3/3/2020

According to the error messages:

* metadata.name: Invalid value: "foldingAtHome": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
* spec.containers[0].name: Invalid value: "foldingAtHome-container01": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')

There are clues to the error occurred:

  1. * metadata.name: Invalid value: "foldingAtHome" only support lower case letters, which is line 4 of your YAML file.
  2. * spec.containers[0].name: Invalid value: "foldingAtHome-container01" also only support lower case characters, which is line 7 of your YAML file.

Change them to lower case should be okay.

-- Brent Chang
Source: StackOverflow