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

Null response when try to create a replicationController #8

Open
bengong2015 opened this issue Jun 2, 2015 · 1 comment
Open

Null response when try to create a replicationController #8

bengong2015 opened this issue Jun 2, 2015 · 1 comment

Comments

@bengong2015
Copy link

It was successful when I tried to create service, but I found the function of create service does not check the http status code = 201 so that it exposed exception: 'Failed: Created'. I fixed this.
When I tried to create or update a replicationControllers, a kubernetesClientException exposed :
SEVERE: Replication Controller [wildfly11-rc] creation failed. Null response received.
com.github.kubernetes.java.client.exceptions.KubernetesClientException: Replication Controller [wildfly11-rc] creation failed.
at com.github.kubernetes.java.client.KubernetesApiClient.handleNullResponse(KubernetesApiClient.java:459)
at com.github.kubernetes.java.client.KubernetesApiClient.createReplicationController(KubernetesApiClient.java:221)
at com.sipm.bcf.ac.server.action.StartAppAction.createReplicationController(StartAppAction.java:62)
at com.sipm.bcf.ac.server.action.StartAppAction.start(StartAppAction.java:28)
at com.sipm.bcf.ac.server.action.StartAppAction.main(StartAppAction.java:93)

The method of createController:
protected boolean createReplicationController(){
rc = new ReplicationController();
State desiredState = new State();
rc.setId(imageName+"-rc");
desiredState = new State();
desiredState.setReplicas(replicas);
Selector selector = new Selector();
selector.setName(imageName+"-sc");
desiredState.setReplicaSelector(selector);
//----------------------------------
Pod podTemplate = new Pod();
State podState = new State();
Manifest manifest = new Manifest();
manifest.setId(imageName+"-rc");
Container container = new Container();
container.setName(imageName);
container.setImage(registryUrl+"/"+imageName);
Port p = new Port();
p.setContainerPort(containerPort);
container.setPorts(Collections.singletonList(p));
manifest.setContainers(Collections.singletonList(container));
podState.setManifest(manifest);
podTemplate.setDesiredState(podState);
podTemplate.setLabels(new Label(imageName+"-sc"));
//-----------------------------------
desiredState.setPodTemplate(podTemplate);
rc.setDesiredState(desiredState);
rc.setLabels(new Label(imageName+"-sc"));
try {
client.createReplicationController(rc);
} catch (KubernetesClientException e) {
e.printStackTrace();
return false;
}
return true;
}
I used api v1beta1 (endpointurl="http://202.120.11.50:8080/api/v1beta1/"). The version of kubernetes is v0.15.0.
I guess it's caused by the kube-api changed some attributes of creating RC since it was failed when I tried to create RC by creating a json file with v1beta1 schema on master and create it by command which was successful in v0.6.

@nirmal070125
Copy link
Owner

@bengong2015 thanks for reporting the issue. Could you send a fix as a PR? I don't have time to spend on this right now :-(

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

2 participants