-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
How to create ingress in Kubernetes V1.23.1 version ? #3999
Comments
@fengqiao117 : You might be looking for
|
For example the ingress case would be like this:
The error message is as followsException in thread "main" io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://10.1.22.98:6443/apis/networking.k8s.io/v1/namespaces/default/ingresses. Message: Ingress.extensions "test-ingress" is invalid: spec.rules[0].http.paths[0].backend: Invalid value: "": resource or service backend is required. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.rules[0].http.paths[0].backend, message=Invalid value: "": resource or service backend is required, reason=FieldValueInvalid, additionalProperties={})], group=extensions, kind=Ingress, name=test-ingress, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Ingress.extensions "test-ingress" is invalid: spec.rules[0].http.paths[0].backend: Invalid value: "": resource or service backend is required, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}). Kubernetes API Server versionv1.22.1 Fabric8 Kubernetes Client version5.12.1 Can you give me a successful example ?ingress controller versionimage: k8s.gcr.io/ingress-nginx/controller:v1.1.1 |
1 similar comment
For example the ingress case would be like this:
The error message is as followsException in thread "main" io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://10.1.22.98:6443/apis/networking.k8s.io/v1/namespaces/default/ingresses. Message: Ingress.extensions "test-ingress" is invalid: spec.rules[0].http.paths[0].backend: Invalid value: "": resource or service backend is required. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.rules[0].http.paths[0].backend, message=Invalid value: "": resource or service backend is required, reason=FieldValueInvalid, additionalProperties={})], group=extensions, kind=Ingress, name=test-ingress, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Ingress.extensions "test-ingress" is invalid: spec.rules[0].http.paths[0].backend: Invalid value: "": resource or service backend is required, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}). Kubernetes API Server versionv1.22.1 Fabric8 Kubernetes Client version5.12.1 Can you give me a successful example ?ingress controller versionimage: k8s.gcr.io/ingress-nginx/controller:v1.1.1 |
The error message is related to PUT performed by createOrReplace. See #3896 and related issues. Fabric8 6 will have basic support for server side apply #3334 - until then you may want to use something like:
This avoids a PUT on replace and when the diff is computed for an edit the buildOrEdit function will make sure that generated fields are retained. |
I'm not sure, but maybe the IngressBackend definition is also incomplete. |
Resolved,Modify the code as follows: thanks! |
I referred to the sample code, but it did not compile successfully. I am using Kubernetes-Client version 5.12.1
Ingress ingress = new IngressBuilder() .withNewMetadata().withName("test-ingress").addToAnnotations("nginx.ingress.kubernetes.io/rewrite-target", "/").endMetadata() .withNewSpec() .addNewRule() .withNewHttp() .addNewPath() .withPath("/testPath").withNewBackend().withServiceName("test").withServicePort(new IntOrString(80)).endBackend() .endPath() .endHttp() .endRule() .endSpec() .build(); client.network().ingress().inNamespace("default").create(ingress);
But I compiled successfully in V4.12.0 using the following methods:
client.extensions().ingresses().createorreplace (ingress);
The text was updated successfully, but these errors were encountered: