The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

CL.Lam (3) [Avatar] Offline
#1
I'm using ubuntu's microk8s to go through the example in the book, but when I come to page 57, deploying catalog service via kube-inject ,the spring-boot app in the pod throwing out the exception:

-------------

Jolokia: Agent started with URL http://10.1.1.125:8778/jolokia/
07:57:36.070 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client from Kubernetes config...
07:57:36.092 [main] DEBUG io.fabric8.kubernetes.client.Config - Did not find Kubernetes config at: [/opt/jboss/.kube/config]. Ignoring.
07:57:36.092 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client from service account...
07:57:36.092 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account ca cert at: [/var/run/secrets/kubernetes.io/serviceaccount/ca.crt].
07:57:36.102 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account token at: [/var/run/secrets/kubernetes.io/serviceaccount/token].
07:57:36.102 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client namespace from Kubernetes service account namespace path...
07:57:36.103 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account namespace at: [/var/run/secrets/kubernetes.io/serviceaccount/namespace].
2019-01-14 07:57:38.014 WARN 1 --- [ main] o.s.cloud.kubernetes.StandardPodUtils : Failed to get pod with name:[catalog-b7bd5dbcc-bscgj]. You should look into this if things aren't working as you expect. Are you missing serviceaccount permissions?

io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Pod] with name: [catalog-b7bd5dbcc-bscgj] in namespace: [istioinaction] failed.
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:62) ~[kubernetes-client-2.4.1.jar!/:na]
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:71) ~[kubernetes-client-2.4.1.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:217) ~[kubernetes-client-2.4.1.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:181) ~[kubernetes-client-2.4.1.jar!/:na]
at org.springframework.cloud.kubernetes.StandardPodUtils.internalGetPod(StandardPodUtils.java:61) [spring-cloud-kubernetes-core-0.2.0.RELEASE.jar!/:0.2.0.RELEASE]
at org.springframework.cloud.kubernetes.StandardPodUtils.lambda$new$0(StandardPodUtils.java:45) [spring-cloud-kubernetes-core-0.2.0.RELEASE.jar!/:0.2.0.RELEASE]
at org.springframework.cloud.kubernetes.LazilyInstantiate.swapper(LazilyInstantiate.java:41) ~[spring-cloud-kubernetes-core-0.2.0.RELEASE.jar!/:0.2.0.RELEASE]
at org.springframework.cloud.kubernetes.LazilyInstantiate.lambda$new$0(LazilyInstantiate.java:34) ~[spring-cloud-kubernetes-core-0.2.0.RELEASE.jar!/:0.2.0.RELEASE]
at org.springframework.cloud.kubernetes.LazilyInstantiate.get(LazilyInstantiate.java:29) ~[spring-cloud-kubernetes-core-0.2.0.RELEASE.jar!/:0.2.0.RELEASE]
at org.springframework.cloud.kubernetes.profile.KubernetesProfileApplicationListener.addKubernetesProfile(KubernetesProfileApplicationListener.java:50) ~[spring-cloud-kubernetes-core-0.2.0.RELEASE.jar!/:0.2.0.RELEASE]
at org.springframework.cloud.kubernetes.profile.KubernetesApplicationContextInitializer.initialize(KubernetesApplicationContextInitializer.java:53) ~[spring-cloud-kubernetes-core-0.2.0.RELEASE.jar!/:0.2.0.RELEASE]
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:635) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:349) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:175) ~[spring-cloud-context-1.2.3.RELEASE.jar!/:1.2.3.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:9smilie ~[spring-cloud-context-1.2.3.RELEASE.jar!/:1.2.3.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:64) ~[spring-cloud-context-1.2.3.RELEASE.jar!/:1.2.3.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:13smilie ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:6smilie ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:337) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:30smilie ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at com.redhat.cloudnative.catalog.CatalogApplication.main(CatalogApplication.java:10) ~[classes!/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:49smilie ~[na:1.8.0_151]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:4smilie ~[catalog-1.0-SNAPSHOT.jar:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[catalog-1.0-SNAPSHOT.jar:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) ~[catalog-1.0-SNAPSHOT.jar:na]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:5smilie ~[catalog-1.0-SNAPSHOT.jar:na]
Caused by: java.net.ConnectException: Failed to connect to kubernetes.default.svc/10.152.183.1:443
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:225) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:149) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.0.jar!/:na]
at io.fabric8.kubernetes.client.utils.HttpClientUtils$2.intercept(HttpClientUtils.java:93) ~[kubernetes-client-2.4.1.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.RealCall.execute(RealCall.java:69) ~[okhttp-3.8.0.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:377) ~[kubernetes-client-2.4.1.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:343) ~[kubernetes-client-2.4.1.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:312) ~[kubernetes-client-2.4.1.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:295) ~[kubernetes-client-2.4.1.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:753) ~[kubernetes-client-2.4.1.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:206) ~[kubernetes-client-2.4.1.jar!/:na]
... 33 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_151]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_151]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_151]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:18smilie ~[na:1.8.0_151]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_151]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_151]
at okhttp3.internal.platform.Platform.connectSocket(Platform.java:124) ~[okhttp-3.8.0.jar!/:na]
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:223) ~[okhttp-3.8.0.jar!/:na]
... 59 common frames omitted

2019-01-14 07:57:38.215 INFO 1 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@e45f292: startup date [Mon Jan 14 07:57:38 UTC 2019]; root of context hierarchy
2019-01-14 07:57:38.746 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$c9ba39c6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

------------
The istio-proxy log out the health check of sprint-boot app return 503 . I try below commands to deploy :

kubectl --namespace=istioinaction create -f <(microk8s.istioctl kube-inject -f install/catalog-service/catalog-all.yaml)

or

kubectl --namespace=default create -f <(microk8s.istioctl kube-inject -f install/catalog-service/catalog-all.yaml)


Is anything wrong with my deployment ? Any hint to fix then let me go on with the book ?

Thanks.
CL.Lam (3) [Avatar] Offline
#2
make a addition: if I deploy the catalog service without istio-inject ,the service is up and serve correctly , I curl it in K8S and return return a JOSN response. So is the failure is caused by my istio ? I use microk8s.enable to install is and go through the previews chapter successfully.
Any reply is helpful.

Thanks.
Rafik8 (2) [Avatar] Offline
#3
I re-install the catalog api (with the last code from github) and be able to get it running. Which version of Istio are you using (mine is 1.0.4).
Could you also check that Istio installation is fine by deploying another application to the cluster, let's try with book-info sample app:

kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/platform/kube/bookinfo.yaml)


CL.Lam (3) [Avatar] Offline
#4
I'm using 1.0.0 come with the microk8s , and the repo I'm told to use in the book is https://github.com/istioinaction/book-source-code , which don't include the source code as you show.
Rafik8 (2) [Avatar] Offline
#5
Oh yes, sorry. I have been so fast. You need to download Istio distribution: https://github.com/istio/istio/releases/tag/1.0.0. Unzip it then you will find the sample application manifest under the mentioned directory.