Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to k8s generates an invalid pod name with underscore character. #18054

Closed
peterclauterbach opened this issue Apr 5, 2023 · 2 comments · Fixed by #18068
Closed

Deploy to k8s generates an invalid pod name with underscore character. #18054

peterclauterbach opened this issue Apr 5, 2023 · 2 comments · Fixed by #18068
Labels
kind/bug Categorizes issue or PR as related to a bug. kube locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. podman-desktop

Comments

@peterclauterbach
Copy link

Bug description

The "deploy to Kubernetes" generates an invalid pod name with an underscore in it i.e. (condescendingcurie_pod).
Removing the underscore from the generated name allows me to deploy the pod into my OpenShift cluster.
The expected behavious is that the generated pod and metadata would not require user intervention to deploy.
P.S. Substituting a dash instead of an underscore works fine.

Operating system

macOS Ventura 13.2.1

Version

0.13.0

Steps to reproduce

  1. pull alpine image
  2. run. container based on alpine image.
  3. Deploy to Kubernetes

Relevant log output

Generated pod to deploy to Kubernetes:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: 2023-04-03T20:43:56.000Z
  labels:
    app: blissfulpikepod
  name: blissfulpike_pod
spec:
  containers:
  - image: [docker.io/library/alpine:latest](http://docker.io/library/alpine:latest)

Pod Name:
blissfulpike_pod
Use Kubernetes Services:
 Replace .hostPort exposure on containers by Services. It is the recommended way to expose ports, as a cluster policy may prevent to use hostPort.
Create OpenShift routes:
 Create OpenShift routes to get access to the exposed ports of this pod.
Kubernetes Context:
admin
Kubernetes namespace:

default
Error: Pod "blissfulpike_pod" is invalid: metadata.name: Invalid value: "blissfulpike_pod": a lowercase RFC 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])?)*')
 Docker Compatibility
 Compose
v0.13.0

Additional context

No response

@peterclauterbach peterclauterbach added the kind/bug Categorizes issue or PR as related to a bug. label Apr 5, 2023
@benoitf benoitf transferred this issue from podman-desktop/podman-desktop Apr 5, 2023
@benoitf
Copy link
Contributor

benoitf commented Apr 5, 2023

hello @peterclauterbach I'm transferring the issue to podman as podman is generating the pod YAML.

issue can be reproduced with a Kubernetes cluster

$ podman pod create my_pod
$ podman run -d -ti --pod my_pod fedora
$ podman kube generate my_pod > /tmp/pod.yaml
$ kubectl apply -f /tmp/foo.yaml                                                                                                                                                                              The Pod "my_pod" is invalid:
* metadata.name: Invalid value: "my_pod": a lowercase RFC 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.hostname: Invalid value: "my_pod": a lowercase RFC 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])?')

@rhatdan
Copy link
Member

rhatdan commented Apr 5, 2023

@umohnani8 PTAL We need this in 4.5?

@rhatdan rhatdan added the 4.5 label Apr 5, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. kube locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. podman-desktop
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants