kubernetes: kubectl should provide better error message when validation failed

I found many users confused when they see this error message:

error validating data: <some error messages>; if you choose to ignore these errors, turn validation off with --validate=false

For most of them, the command just failed, and they don’t know how to move on.

We should provide better error message, and communicate better what they should do next.

@kubernetes/sig-cli-feature-requests

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 14
  • Comments: 37 (8 by maintainers)

Most upvoted comments

kubectl --namespace=default apply -f deployment/production/deployment.yaml

...
&{0xc4200e4780 0xc42013c230 default my-api deployment/production/deployment.yaml 0xc42010e5b0 0xc42010ebf8 13401 false}
for: "deployment/production/deployment.yaml": unrecognized type: string

Don’t know if this is same issue but this is what i get when i do the following lol 😄

      nodeSelector:
        role-app: true
      nodeSelector:
        role-app: "true"

Not even a line number

Agree that this should give the line number / character offset. Also, I think the point has been made elsewhere, but would be great if --validate / --dry-run caught these errors (for me, it doesn’t seem to).

@wyardley: You can’t reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

/reopen

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

I got the same error as @gertcuykens for the very same reason (using true instead of "true" in a container’s environment variable value. A better error message would go a long way here 😄