eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
774 stars 520 forks source link

Can anyone tell me how to solve this problem:java.net.UnknownHostException: kubernetes.default.svc #1103

Open kuailexingmao opened 3 years ago

kuailexingmao commented 3 years ago

I am using org.eclipse.jkube:openshift-maven-plugin, but the build fails. My configuration is as follows:

<plugin>
    <groupld>org.eclipse.jkube</groupld>
    <artifactld>openshift-maven-plugin</artifactld>
    <version>l.5.l</version>
    <executions>
        <execution>
            <id>build-image</id>
            <phase>package</phase>
            <goals>
                <goal>build</goal>
                <goal>push</goal>
                <! --<goal>deploy</goal>-->
            </goals>
        </execution>
    </executions>
    <configuration>
        <dockerHost>${docker.maven.plugin.dockerhost}</dockerHost>
        <skip>${docker.maven.plugin.docker.skip}</skip>
        <verbose>true</verbose>
        <images>
            < image>
                <name>${docker.maven.plugin.docker.register}/${d^ckernanie}:${docker.maven.plugin.docker.tag}</name>
                < build>
                    <dockerFile>${project.basedir}/src/docker/Dockerfile</dockerFile>
                </build>
            </image>
        </images>
    </configuration>
</plugin>                                                                                            

Is there a problem with my configuration, can you tell me?Do I need to configure other files? I read the official document, but I don't understand it a little too vaguely. Where can I see the detailed configuration about deploying to OPENSHIFT, I personally feel that the official documentation is too general.

Can you help me solve this problem first?Thx

manusa commented 2 years ago

The plugin is not detecting your .kube/config and thinks that it's being executed from within a Pod.

Are you sure you are logged in to your OpenShift cluster (oc login...)?