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

Creating deployment for nginx for Azure fails with ReadString: expects " or n, but found error #2951

Closed
shashank-g172 opened this issue Aug 16, 2018 · 5 comments

Comments

@shashank-g172
Copy link

Is this a request for help? : Yes.

What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.): Azure, nginx,


Is this a BUG REPORT or FEATURE REQUEST? : Really not sure, but it's just a question.

NGINX Ingress controller version:

Kubernetes version (use kubectl version): Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"windows/amd64"}

Environment:

  • Cloud provider or hardware configuration: Azure
  • OS (e.g. from /etc/os-release): Windows 64
  • Kernel (e.g. uname -a):
  • Install tools: Java Fabric 8
  • Others:

What happened: When I try to deploy the suggested nginx controller yaml file as descibed here: https://kubernetes.github.io/ingress-nginx/deploy/#azure - The deployment fails with this response: Failure executing: POST at : https://{clusterEndpoint}/apis/extensions/v1beta1/namespaces/ingress-nginx/deployments Message: Service in version "v1" cannot be handled as a Deployment: v1.Service.Spec: v1.ServiceSpec.Selector: ReadString: expects " or n, but found [, error found in #10 byte of ...|essions":[],"app":"i|..., bigger context ...|nces":[]},"spec":{"selector":{"matchExpressions":[],"app":"ingress-nginx"},"externalTrafficPolicy":"|.... Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=Service in version "v1" cannot be handled as a Deployment: v1.Service.Spec: v1.ServiceSpec.Selector: ReadString: expects " or n, but found [, error found in #10 byte of ...|essions":[],"app":"i|..., bigger context ...|nces":[]},"spec":{"selector":{"matchExpressions":[],"app":"ingress-nginx"},"externalTrafficPolicy":"|..., metadata=ListMeta(resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).

What you expected to happen: The deployment should go through as expected especially since I'm using a copied over yaml file.

How to reproduce it (as minimally and precisely as possible): I'm trying to do this through the Fabric8 java REST client.

For brevity and simplification, I'm assuming here that the Kubernetes client object has been instantiated, and using the easiest readable form of code:

private void doNginxStuff(KubernetesClient instantiateKubernetesClient) throws FileNotFoundException {
File initialFile = new File("src/main/resources/nginx-controller.yaml");
InputStream targetStream = new FileInputStream(initialFile);
instantiateKubernetesClient.extensions().deployments().load(targetStream).create();
}

And here's the nginx-controller.yaml file:
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app: ingress-nginx
spec:
externalTrafficPolicy: Local
type: LoadBalancer
selector:
app: ingress-nginx
ports:

  • name: http
    port: 80
    targetPort: http
  • name: https
    port: 443
    targetPort: https

Anything else we need to know: I'm unsure about whether this is the right channel to ask for help, and I'm not sure if this a bug report or not. What's interesting is that in the response from the POST to the deployment, the version of the apis/extensions is v1beta1 but the yaml file is v1.

@aledbf
Copy link
Member

aledbf commented Aug 16, 2018

@shashank-g172 kubectl version should return info about the server.

@shashank-g172
Copy link
Author

Here's the kubectl version output:
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.5", GitCommit:"32ac1c9073b132b8ba18aa830f46b77dcceb0723", GitTreeState:"clean", BuildDate:"2018-06-21T11:34:22Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

@antoineco
Copy link
Contributor

You're using the extensions API (which is deprecated btw, please use apps) to push mixed object types (Services, ConfigMaps, ...). That can not work.

When you use kubectl, the tool deserializes the objects for you and creates them against the appropriate API. But when you do this programmatically, there is a little bit more to be done on your side.

Please refer to the fabric8 documentation to find out how to do wüst you're trying to do.

@antoineco
Copy link
Contributor

@aledbf not an issue

@aledbf aledbf closed this as completed Aug 19, 2018
@antoineco
Copy link
Contributor

I read this in Slack today and it reminded me of that issue:
https://kubernetes.slack.com/archives/C0EG7JC6T/p1534884572000100

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

3 participants