Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ricardozanini/k8s-svc-discovery
Kubernetes clients playground to test client libraries with native images
https://github.com/ricardozanini/k8s-svc-discovery
docker fabric8 kubernetes openshift
Last synced: 28 days ago
JSON representation
Kubernetes clients playground to test client libraries with native images
- Host: GitHub
- URL: https://github.com/ricardozanini/k8s-svc-discovery
- Owner: ricardozanini
- License: apache-2.0
- Created: 2019-06-10T13:27:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T17:51:06.000Z (about 3 years ago)
- Last Synced: 2024-10-04T10:12:04.584Z (about 1 month ago)
- Topics: docker, fabric8, kubernetes, openshift
- Language: Java
- Size: 95.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kubernetes Service Discovery on Quarkus
Sandbox project for experimentations with native image on the Kubernetes Service API using the [Official Java Client](https://github.com/kubernetes-client/java) and the [Fabric8 Kubernetes Client](https://github.com/fabric8io/kubernetes-client).
## How to play
Just run a couple commands in your terminal and make sure that you have access to a reachable Kubernetes cluster:
```shell
# Clone and cd to the directory
$ git clone https://github.com/ricardozanini/k8s-svc-discovery.git
$ cd k8s-svc-discovery# build
./mvnw clean package -Pnative
```Having the binaries compiled, choose your destiny.
**Kubernetes Official Client**
```
# run
./k8s-client-java/target/k8s-client-java-1.0-SNAPSHOT-runner -DK8S_SVC_CLUSTER_URL= -DK8S_SVC_CLUSTER_TOKEN=$(oc whoami -t) -DK8S_SVC_CLUSTER_VALIDATE_CERT=false -Djava.library.path=$GRAALVM_HOME/jre/lib/amd64 -Djavax.net.ssl.trustStore=$GRAALVM_HOME/jre/lib/security/cacerts
```**Fabric8 Client**
```
# run
./fabric8-client/target/fabric8-client-1.0-SNAPSHOT-runner -DK8S_SVC_CLUSTER_URL= -DK8S_SVC_CLUSTER_TOKEN=$(oc whoami -t) -DK8S_SVC_CLUSTER_VALIDATE_CERT=false -Djava.library.path=$GRAALVM_HOME/jre/lib/amd64 -Djavax.net.ssl.trustStore=$GRAALVM_HOME/jre/lib/security/cacerts
```**Kogito Client**
```
# run
./kogito-client/target/kogito-client-1.0-SNAPSHOT-runner -DK8S_SVC_CLUSTER_URL= -DK8S_SVC_CLUSTER_TOKEN=$(oc whoami -t) -DK8S_SVC_CLUSTER_VALIDATE_CERT=false -Djava.library.path=$GRAALVM_HOME/jre/lib/amd64
```Then go to [http://localhost:8080/services/yournamespacename](http://localhost:8080/services/yournamespacename) and you should see a list of Services deployed into the namespace. :)
### Notes
1. Make sure to set `K8S_SVC_CLUSTER_VALIDATE_CERT` to **`false`** if your cluster has a self signed certificate.
2. Have the [GraalVM installed](https://gist.github.com/ricardozanini/fa65e485251913e1467837b1c5a8ed28) and the `GRAALVM_HOME` environment variable set to it's home dir.
3. When experimenting with `k8s-client-java` you might face a similar exception like the following: `java.io.IOException: Resource not found: "org/joda/time/tz/data/America/Sao_Paulo" ClassLoader: java.lang.ClassLoader@24afc28`. It's caused by the Joda time library that the Swagger is dependent. Just ignore it for now.## The Docker Image
There's a working image at:
https://quay.io/repository/ricardozanini/kogito-svc-discoveryYou can run it with the following command:
```
docker run -i --rm -p 8080:8080 -e KUBERNETES_MASTER= -e KUBERNETES_AUTH_TOKEN=$(oc whoami -t) -e KUBERNETES_TRUST_CERTIFICATES=true quay.io/ricardozanini/kogito-svc-discovery
```### Building the Kogito Client Image
There's a script ready for you at [kogito-client/build-image.sh](kogito-client/build-image.sh). Use it as a reference to build yours.