kubernetes: Deployment names can be too long, such that ReplicaSet creation fails
This Deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: use-a-very-long-name-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: iamyouare
template:
metadata:
labels:
app: iamyouare
spec:
containers:
- image: thockin/iamyouare
name: iamyouare
…is accepted but always fails:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning ReplicaSetCreateError 1s (x13 over 22s) deployment-controller Failed to create new replica set "use-a-very-long-name-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-12-6bb58d578b": ReplicaSet.apps "use-a-very-long-name-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-12-6bb58d578b" is invalid: metadata.name: Invalid value: "use-a-very-long-name-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-12-6bb58d578b": must be no more than 253 characters
Deployment controller needs to truncate it’s own name to make room for the ReplicaSet suffix and eventually the pod suffix.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 32 (32 by maintainers)
I think we would simply API-fail > 242.
On Mon, May 1, 2023 at 2:43 PM Antonio Ojea @.***> wrote: