项目作者: eclipse

项目描述 :
Successor of the deprecated Fabric8 Maven Plugin
高级语言: Java
项目地址: git://github.com/eclipse/jkube.git
创建时间: 2019-10-22T13:04:50Z
项目社区:https://github.com/eclipse/jkube

开源协议:Eclipse Public License 2.0

下载


Eclipse JKube

Cloud-Native Java Applications without a hassle

E2E Tests
Maintainability Rating
Coverage
Gitter
Twitter

Open in Gitpod



Eclipse JKube

Contents

Introduction

Eclipse JKube is a collection of plugins and libraries that are used for building container images using Docker, JIB or
S2I build strategies. Eclipse JKube generates and deploys Kubernetes/OpenShift manifests at compile time too.

It brings your Java applications on to Kubernetes and OpenShift by leveraging the tasks required to make your
application cloud-native.

Eclipse JKube also provides a set of tools such as watch, debug, log, etc. to improve your developer experience.
This project contains various building blocks for the Kubernetes Java developer toolbox.

Kubernetes Maven Plugin

  • Maven Central
  • Documentation
  • Add to project:
    1. <plugin>
    2. <groupId>org.eclipse.jkube</groupId>
    3. <artifactId>kubernetes-maven-plugin</artifactId>
    4. <version>${jkube.version}</version>
    5. </plugin>
  • Run the JKube commands, for instance:
    1. mvn package k8s:build k8s:push k8s:resource k8s:apply
  • :tv: Watch 2-minute demo on YouTube:

KubernetesMavenPluginDemo

Kubernetes Gradle Plugin

  • Maven Central
  • Documentation
  • Add to project:
    1. plugins {
    2. id "org.eclipse.jkube.kubernetes" version "${jKubeVersion}"
    3. }
  • Run the JKube commands, for instance:
    1. gradle build k8sBuild k8sPush k8sResource k8sApply
  • :tv: Watch 2-minute demo on YouTube:

KubernetesGradlePluginDemo

OpenShift Gradle Plugin

  • Maven Central
  • Documentation
  • Add to project:
    1. plugins {
    2. id "org.eclipse.jkube.openshift" version "${jKubeVersion}"
    3. }
  • Run the JKube commands, for instance:
    1. gradle build ocBuild ocResource ocApply
  • :tv: Watch 2-minute demo on YouTube:

OpenShiftGradlePluginDemo

OpenShift Maven Plugin

  • Maven Central
  • Documentation
  • Add to project:
    1. <plugin>
    2. <groupId>org.eclipse.jkube</groupId>
    3. <artifactId>openshift-maven-plugin</artifactId>
    4. <version>${jkube.version}</version>
    5. </plugin>
  • Run the JKube commands, for instance:
    1. mvn package oc:build oc:resource oc:apply
  • :tv: Watch 2-minute demo on YouTube:

OpenShiftMavenPluginDemo

Getting started

You can take a look at our quickstarts in quickstarts directory that contain sample maven and gradle projects using the latest version of jkube plugin.

Hello World using Eclipse JKube

  • Clone repository and move to quickstart helloworld sample, build project and run JKube goals:

```shell script

1. Clone repository

$ git clone git@github.com:eclipse/jkube.git

2. Move to Hello World Quickstart folder

$ cd jkube/quickstarts/maven/hello-world

3. Configure your local environment to re-use the Docker daemon inside the Minikube instance.

~ jkube/quickstarts/maven/hello-world : $ eval $(minikube -p minikube docker-env)

4. Build Project and run JKube goals

$ mvn clean install \
k8s:build # Build Docker Image \
k8s:resource # Generate Kubernetes Manifests \
k8s:apply # Apply generated Kubernetes Manifests onto Kubernetes

  1. - Check created pod logs:
  2. ```shell script
  3. # Using Kubectl
  4. $ kubectl get pods
  5. NAME READY STATUS RESTARTS AGE
  6. helloworld-664bf5fdff-2bmrt 1/1 Running 0 9s
  7. $ kubectl get svc
  8. helloworld NodePort 10.110.92.145 <none> 8080:32353/TCP 58m
  9. kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 7h
  10. $ curl `minikube ip`:32353/hello
  11. Hello World

Troubleshooting

If you experience problems using minikube that pod’s status shows ‘ImagePullBackOff’ and not ‘Running’ you must share the minikube’s docker daemon environment with your shell with:

```shell script
$ eval $(minikube -p minikube docker-env)

  1. You can remove this from your shell again with:
  2. ```shell script
  3. $ eval $(minikube docker-env -u)

If you don’t want to type the command for every new terminal you open, you can add the command to your .bash_profile
on mac or .zshrc.

Rebranding Notice :loudspeaker:

This project is not an effort from scratch. It was earlier called
Fabric8 Maven Plugin.
It is just refactored and rebranded version of the project targeted towards Java developers who are working on top of
Kubernetes. For more information about history, please see REBRANDING.md