java.lang.IllegalStateException: when I create Kubernetes Job

730 views
Skip to first unread message

Pradeep Ganachari

unread,
May 12, 2016, 6:14:05 AM5/12/16
to fabric8
Hello,

I am trying to create Kubernetes Job using following code.
client.extensions().jobs().inNamespace("aa-system").create(job);
with all necessary data filled in job.

Getting following exception.
FAILED: java.lang.IllegalStateException: No adapter available for type:class io.fabric8.kubernetes.client.ExtensionsAPIGroupClient
java.lang.IllegalStateException: No adapter available for type:class io.fabric8.kubernetes.client.ExtensionsAPIGroupClient
        at io.fabric8.kubernetes.client.BaseClient.adapt(BaseClient.java:135)
        at io.fabric8.kubernetes.client.DefaultKubernetesClient.extensions(DefaultKubernetesClient.java:214)


any suggestions would be appreciated.

Regards,
Pradeep

James Strachan

unread,
May 13, 2016, 11:27:09 AM5/13/16
to Pradeep Ganachari, fabric8

--
James
-------
Red Hat

Twitter: @jstrachan
Email: james.s...@gmail.com
Blog: https://medium.com/@jstrachan/

open source microservices platform

Pradeep Ganachari

unread,
May 14, 2016, 4:04:55 AM5/14/16
to James Strachan, fabric8
I have resolved the above issue. there was some problem with my build.sbt it seems.

now I am getting below exception.

FAILED: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
        at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:57)
        at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:234)
        at com.aruba.test.test_app.main(test_app.java:117)
Caused by: javax.net.ssl.SSLPeerUnverifiedException: Hostname kubernetes.default.svc not verified:
    certificate: sha1/pn3xC0EodJTjGo5zetEr8QSgnyo=
    DN: CN=kube-apiserver
    subjectAltNames: [10.3.0.1, 10.22.42.243, kubernetes, kubernetes.default]

could you  please help me out to resolve this?

Jimmi Dyson

unread,
May 14, 2016, 4:25:38 AM5/14/16
to Pradeep Ganachari, James Strachan, fabric8

The error indicates that the certificate isn't valid for kubernetes.default.svc. We've been recommended by kubernetes maintainers that this is the canonical address for pods contacting the api server from inside a cluster.

There are a few ways to fix/workaround this.

First option (best option) is to recreate your api server certificate with the addition of kubernetes.default.svc as a valid hostname. How you do that depends on how you've deployed kubernetes. If you need help with that, let us know how you deployed it & we can try to help with that if we've seen it before.

Second option, which I would only use for development environments personally, is to disable certificate validation. Note that this opens you up for man in the middle attacks so be careful where you use it (& don't use it if at all possible!). To disable certificate validation, set the environment variable KUBERNETES_TRUST_CERTIFICATES to true in the pod/shell you're running your app.


--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pradeep Ganachari

unread,
May 14, 2016, 4:59:11 AM5/14/16
to Jimmi Dyson, James Strachan, fabric8
Thanks for your inputs.

Need your help with recreation of api server certificate . Kubernetes has been deployed as below.
As I am new to this, kindly excuse if any wrong in explanation. :)

3 nodes (core os) + 1 sentinel (ubuntu vm.)
kubectl, kubelet, kube-apiserver are in sentinel. application(replicationcontroller) which creates kube job is created using ./kubectl in sentinel.






Pradeep Ganachari

unread,
May 15, 2016, 10:27:15 AM5/15/16
to Jimmi Dyson, James Strachan, fabric8
Followed the link "https://coreos.com/kubernetes/docs/latest/openssl.html" and did configuration in sentinel node.
Even have set the environment variable KUBERNETES_TRUST_CERTIFICATES to true.

No luck :( still getting the below exception.

io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
        at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:57)
        at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:234)
        at com.aruba.test.test_app.main(test_app.java:117)
Caused by: javax.net.ssl.SSLPeerUnverifiedException: Hostname kubernetes.default.svc not verified:
    certificate: sha1/pn3xC0EodJTjGo5zetEr8QSgnyo=
    DN: CN=kube-apiserver

I have 1 sentinel node (unbuntu vm) + 3 nodes (coreos). I have another Ubuntu in which I ran ansible script where sentinel and nodes IP addresses are configure.

suggestions please.
Reply all
Reply to author
Forward
0 new messages