-
Notifications
You must be signed in to change notification settings - Fork 31
Description
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.