Skip to content

SunCertPathBuilderException: unable to find valid certification path to requested target when connecting to k3d #996

Closed
@ghost

Description

Bug Report

What did you do?

I have an operator running fine in Docker Desktop/Kubernetes. I need to make it work in Docker Desktop/k3d. Starting the operator from IntelliJ fails on startup.

What did you expect to see?

The operator should start and connect to the cluster.

What did you see instead? Under which circumstances?

2022-03-04T16:25:47,009 INFO  [restartedMain] o.s.b.StartupInfoLogger: Starting CMCCOperatorApplication using Java 11.0.14.1 on rdde026f with PID 49687 (/Users/stbe/develop/cmcc-operator/build/classes/java/main started by stbe in /Users/stbe/develop/cmcc-operator)
2022-03-04T16:25:47,010 DEBUG [restartedMain] o.s.b.StartupInfoLogger: Running with Spring Boot v2.6.4, Spring v5.3.16
2022-03-04T16:25:47,011 INFO  [restartedMain] o.s.b.SpringApplication: No active profile set, falling back to 1 default profile: "default"
2022-03-04T16:25:47,027 INFO  [restartedMain] o.s.b.l.DeferredLog: Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-03-04T16:25:51,726 INFO  [restartedMain] i.j.o.Operator: Registered reconciler: 'coremediacontentcloudreconciler' for resource: 'class com.tsystemsmms.cmcc.cmccoperator.crds.CoreMediaContentCloud' for namespace(s): [all namespaces]
2022-03-04T16:25:51,727 INFO  [restartedMain] i.j.o.Operator: Operator SDK 2.0.1 (commit: d3863e1) built on 2022-01-17T20:43:41.000+0100 starting...
2022-03-04T16:25:51,727 INFO  [restartedMain] i.j.o.Operator: Client version: 5.12.1
2022-03-04T16:25:51,799 WARN  [restartedMain] o.s.c.s.AbstractApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'operator' defined in class path resource [io/javaoperatorsdk/operator/springboot/starter/OperatorAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.javaoperatorsdk.operator.Operator]: Factory method 'operator' threw exception; nested exception is io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get]  for kind: [CustomResourceDefinition]  with name: [coremediacontentclouds.cmcc.tsystemsmms.com]  in namespace: [null]  failed.
...
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Environment

Kubernetes cluster type:

Docker Desktop with k3d

implementation 'io.javaoperatorsdk:operator-framework-spring-boot-starter:2.0.1'

$ java -version

$ java -version
openjdk version "11.0.14.1" 2022-02-08 LTS
OpenJDK Runtime Environment Zulu11.54+25-CA (build 11.0.14.1+1-LTS)
OpenJDK 64-Bit Server VM Zulu11.54+25-CA (build 11.0.14.1+1-LTS, mixed mode)

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:30:48Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"darwin/arm64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.6+k3s1", GitCommit:"3228d9cb9a4727d48f60de4f1ab472f7c50df904", GitTreeState:"clean", BuildDate:"2022-01-25T01:14:20Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/arm64"}

Possible Solution

I thought that setting the system property -Dkubernetes.trust.certificates=true (for the fabric8 client) should disable the certificate verification, but that had no effect.

I've also set the Spring Boot property javaoperatorsdk.client.trustSelfSignedCertificates=true and verified with the debugger that it is set, but there is no change.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions