- Notifications
You must be signed in to change notification settings - Fork 2
provide example for both spring cloud kubernetes clients #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits Select commit Hold shift + click to select a range
ed44e65
testing kubernetes discovery client
ulischulte d3c5d82
WIP
ulischulte 119045e
fix paths
erikpetzold 446c5be
update README.md
erikpetzold bb8c689
Fixed link text
ulischulte 200fc40
Cleanup
ulischulte f0f3dff
Set version of spring-boot-admin back to 3.0.4 for spring-boot-admin-…
ulischulte 8e3c3e2
Updated SBA versions
ulischulte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
| ||
# Build App | ||
mvn clean install | ||
# Build Docker Image | ||
docker build --tag spring-boot-admin:fabric8 . | ||
# Install App | ||
helm upgrade --install spring-boot-admin-fabric8 ../../helm-charts/spring-boot-admin -f deployment/values.yml |
5 changes: 5 additions & 0 deletions 5 kubernetes/apps/spring-boot-admin-fabric8/deployment/values.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: spring-boot-admin-fabric8 | ||
namespace: default | ||
| ||
deployment: | ||
image: spring-boot-admin:fabric8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
target | ||
.idea | ||
*.iml | ||
*.log | ||
*.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# https://hub.docker.com/_/eclipse-temurin/ | ||
FROM eclipse-temurin:17 | ||
| ||
VOLUME /tmp | ||
| ||
COPY target/app.jar /opt/app/app.jar | ||
| ||
CMD ["bash", "-c", "java $JAVA_OPTS -jar /opt/app/app.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Spring Boot Admin | ||
| ||
## Build & Install Script | ||
| ||
You can run the whole build and installation with the following script or follow the step by step guide below. | ||
| ||
```bash | ||
chmod u+x buildAndInstall.sh | ||
./buildAndInstall.sh | ||
``` | ||
| ||
## Step-by-step build | ||
| ||
### Build App | ||
```bash | ||
mvn clean install | ||
``` | ||
| ||
### Build Docker Image | ||
```bash | ||
docker build --tag spring-boot-admin:kubernetes . | ||
``` | ||
| ||
### Install App | ||
```bash | ||
helm upgrade --install spring-boot-admin-kubernetes ../../helm-charts/spring-boot-admin -f deployment/values.yml | ||
``` | ||
| ||
### Check deployment | ||
```bash | ||
kubectl get pods -o wide | ||
kubectl get services -o wide | ||
kubectl get ingress | ||
kubectl get serviceaccount | ||
kubectl get role | ||
kubectl get rolebinding -o wide | ||
``` | ||
| ||
### Uninstall | ||
```bash | ||
helm uninstall spring-boot-admin-kubernetes | ||
``` | ||
| ||
## URI | ||
| ||
- http://localhost/spring-boot-admin-kubernetes | ||
| ||
## Access Actuator | ||
```bash | ||
kubectl get pods | ||
``` | ||
```bash | ||
kubectl port-forward <pod-name> 9091:9091 | ||
``` | ||
### URI | ||
| ||
- http://localhost:9091/actuator |
8 changes: 8 additions & 0 deletions 8 kubernetes/apps/spring-boot-admin-kubernetes/buildAndInstall.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
| ||
# Build App | ||
mvn clean install | ||
# Build Docker Image | ||
docker build --tag spring-boot-admin:kubernetes . | ||
# Install App | ||
helm upgrade --install spring-boot-admin-kubernetes ../../helm-charts/spring-boot-admin -f deployment/values.yml |
9 changes: 9 additions & 0 deletions 9 kubernetes/apps/spring-boot-admin-kubernetes/deployment/values.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: spring-boot-admin-kubernetes | ||
namespace: default | ||
| ||
deployment: | ||
server: | ||
port: 9090 | ||
management: | ||
port: 9091 | ||
image: spring-boot-admin:kubernetes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
| ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.0.6</version> | ||
</parent> | ||
| ||
<groupId>de.codecentric</groupId> | ||
<artifactId>spring-boot-admin-kubernetes</artifactId> | ||
<packaging>jar</packaging> | ||
<name>${project.artifactId}</name> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<description>Spring Boot Admin</description> | ||
| ||
<properties> | ||
<java.version>17</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<spring-boot-admin.version>3.0.5-SNAPSHOT</spring-boot-admin.version> | ||
<spring-cloud.version>2022.0.2</spring-cloud.version> | ||
</properties> | ||
| ||
<!-- Kubernetes Discovery --> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-dependencies</artifactId> | ||
<version>${spring-cloud.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
| ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
| ||
<!-- Spring Boot Admin --> | ||
<dependency> | ||
<groupId>de.codecentric</groupId> | ||
<artifactId>spring-boot-admin-starter-server</artifactId> | ||
<version>${spring-boot-admin.version}</version> | ||
</dependency> | ||
| ||
<!-- Kubernetes Discovery --> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-kubernetes-client</artifactId> | ||
</dependency> | ||
</dependencies> | ||
| ||
<build> | ||
<finalName>app</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>repackage</id> | ||
<goals> | ||
<goal>repackage</goal> | ||
<!-- Build-Infos for Info-Actuator --> | ||
<goal>build-info</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- GIT-Infos for Info-Actuator --> | ||
<plugin> | ||
<groupId>io.github.git-commit-id</groupId> | ||
<artifactId>git-commit-id-maven-plugin</artifactId> | ||
<configuration> | ||
<offline>true</offline> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
| ||
</project> |
21 changes: 21 additions & 0 deletions 21 ...n-kubernetes/src/main/java/de/codecentric/springbootadmin/SpringBootAdminApplication.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package de.codecentric.springbootadmin; | ||
| ||
import de.codecentric.boot.admin.server.config.EnableAdminServer; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
| ||
@SpringBootApplication | ||
@EnableAdminServer | ||
// Enable scheduled discovery of services | ||
@EnableScheduling | ||
public class SpringBootAdminApplication { | ||
| ||
public static void main(String... args) { | ||
var app = new SpringApplication(SpringBootAdminApplication.class); | ||
// Buffering for Startup-Actuator | ||
app.setApplicationStartup(new BufferingApplicationStartup(2048)); | ||
app.run(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to merge this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have turned the version back to 3.0.4. In the spring-boot-admin-kubernetes module, however, the 3.0.5-SNAPSHOT is necessary until the next release...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since version 3.1.0 was just released, I changed the versions in both modules accordingly.