Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ This Readme will guide you through all setup steps for the infrastructure.
- <https://kubernetes.io/docs/reference/kubectl/cheatsheet/>

### Change Kubernetes Context

```bash
kubectl config get-contexts
kubectl config use-context docker-desktop
kubectl config set-context --current --namespace=default
```

## Install Helm
Expand Down Expand Up @@ -82,3 +84,15 @@ helm upgrade --install <your-app-name> helm-charts/spring-boot-app --set name=<y
```bash
helm uninstall <your-app-name>
```

## Check Kubernetes Resources

```bash
kubectl get all -o wide
```

## Pull Traefik Image

```bash
docker pull traefik:3
```
2 changes: 1 addition & 1 deletion kubernetes/apps/health-simulator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.6</version>
<version>4.0.0</version>
</parent>

<groupId>de.codecentric</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.codecentric.healthsimulator.health;

import lombok.RequiredArgsConstructor;
import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.health.contributor.Status;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.health.contributor.Health;
import org.springframework.boot.health.contributor.HealthIndicator;
import org.springframework.boot.health.contributor.Status;
import org.springframework.stereotype.Component;

@Component
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/apps/hello-world/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.6</version>
<version>4.0.0</version>
</parent>

<groupId>de.codecentric</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: spring-boot-admin-discoveryclient
namespace: default

deployment:
env:
Expand Down
6 changes: 3 additions & 3 deletions kubernetes/apps/spring-boot-admin-discoveryclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.6</version>
<version>4.0.0</version>
</parent>

<groupId>de.codecentric</groupId>
Expand All @@ -20,8 +20,8 @@
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot-admin.version>3.5.5</spring-boot-admin.version>
<spring-cloud.version>2025.0.0</spring-cloud.version>
<spring-boot-admin.version>4.0.0-M1</spring-boot-admin.version>
<spring-cloud.version>2025.1.0</spring-cloud.version>
</properties>

<!-- Kubernetes Discovery -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: spring-boot-admin-fabric8
namespace: default

deployment:
env:
Expand Down
6 changes: 3 additions & 3 deletions kubernetes/apps/spring-boot-admin-fabric8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.6</version>
<version>4.0.0</version>
</parent>

<groupId>de.codecentric</groupId>
Expand All @@ -20,8 +20,8 @@
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot-admin.version>3.5.5</spring-boot-admin.version>
<spring-cloud.version>2025.0.0</spring-cloud.version>
<spring-boot-admin.version>4.0.0-M1</spring-boot-admin.version>
<spring-cloud.version>2025.1.0</spring-cloud.version>
</properties>

<!-- Kubernetes Discovery -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: spring-boot-admin-kubernetes
namespace: default

deployment:
env:
Expand Down
6 changes: 3 additions & 3 deletions kubernetes/apps/spring-boot-admin-kubernetes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.6</version>
<version>4.0.0</version>
</parent>

<groupId>de.codecentric</groupId>
Expand All @@ -20,8 +20,8 @@
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot-admin.version>3.5.5</spring-boot-admin.version>
<spring-cloud.version>2025.0.0</spring-cloud.version>
<spring-boot-admin.version>4.0.0-M1</spring-boot-admin.version>
<spring-cloud.version>2025.1.0</spring-cloud.version>
</properties>

<!-- Kubernetes Discovery -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spring:
boot:
admin:
ui:
# public-url: ${SPRING_BOOT_ADMIN_UI_PUBLIC_URL:http://localhost:8080}
# public-url: ${SPRING_BOOT_ADMIN_UI_PUBLIC_URL:http://localhost:9090}
title: ${SPRING_BOOT_ADMIN_UI_TITLE:Spring Boot Admin}
brand: <img src="assets/img/icon-spring-boot-admin.svg"><span>${SPRING_BOOT_ADMIN_UI_TITLE:Spring Boot Admin}</span>
cloud:
Expand Down
3 changes: 1 addition & 2 deletions kubernetes/helm-charts/spring-boot-admin/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ deployment:
env:
SPRING_BOOT_ADMIN_UI_TITLE: Spring Boot Admin - Kubernetes
image: spring-boot-admin
# do not pull image but use locally built image, not recommended for production
pullPolicy: Never
pullPolicy: Always
updateStrategy: RollingUpdate
maxSurge: 100%
maxUnavailable: 0%
Expand Down
5 changes: 2 additions & 3 deletions kubernetes/helm-charts/spring-boot-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ namespace: default

deployment:
image: spring-boot-app-default
# do not pull image but use locally built image, not recommended for production
pullPolicy: Never
pullPolicy: Always
updateStrategy: RollingUpdate
maxSurge: 100%
maxUnavailable: 0%
Expand All @@ -20,4 +19,4 @@ deployment:
port: 8080
management:
port: 8081
group: default
group: default
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ https://docs.spring.io/spring-cloud-kubernetes/reference/spring-cloud-kubernetes

## Install Spring Cloud Kubernetes Discovery Server
```bash
helm upgrade --install spring-cloud-kubernetes-discoveryserver .
helm upgrade --install spring-cloud-kubernetes-discoveryserver . -f values.yaml
```

### Check deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ roleRef:
name: namespace-reader
subjects:
- kind: ServiceAccount
name: spring-cloud-kubernetes-discoveryserver
name: spring-cloud-kubernetes-discoveryserver
namespace: {{ .Values.namespace }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: default
name: namespace-reader
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ namespace: default

deployment:
# https://hub.docker.com/r/springcloud/spring-cloud-kubernetes-discoveryserver/tags
image: springcloud/spring-cloud-kubernetes-discoveryserver:3.3.0
pullPolicy: IfNotPresent
image: springcloud/spring-cloud-kubernetes-discoveryserver:5.0.0-M4
pullPolicy: Always
updateStrategy: RollingUpdate
maxSurge: 100%
maxUnavailable: 0%
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/helm-charts/traefik/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ https://doc.traefik.io/traefik/getting-started/quick-start-with-kubernetes/

## Install Traefik
```bash
helm upgrade --install traefik .
helm upgrade --install traefik . -f values.yaml
```

### Check deployment
Expand Down
3 changes: 2 additions & 1 deletion kubernetes/helm-charts/traefik/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: traefik-deployment
namespace: {{ .Values.namespace }}
labels:
app: traefik

Expand All @@ -18,7 +19,7 @@ spec:
serviceAccountName: traefik-account
containers:
- name: traefik
image: traefik:v2.9
image: {{ .Values.deployment.image }}
args:
- --api.insecure
- --providers.kubernetesingress
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/helm-charts/traefik/templates/role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: traefik-account
namespace: default # Using "default" because we did not specify a namespace when creating the ClusterAccount.
namespace: {{ .Values.namespace }}
14 changes: 12 additions & 2 deletions kubernetes/helm-charts/traefik/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,29 @@ metadata:
name: traefik-role

rules:
# Core Kubernetes Ressourcen
- apiGroups:
- ""
resources:
- services
- endpoints
- secrets
- nodes
verbs:
- get
- list
- watch
# EndpointSlices
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
- get
# Standard Kubernetes Ingress API
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses
Expand All @@ -25,7 +36,6 @@ rules:
- list
- watch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses/status
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/helm-charts/traefik/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: traefik-dashboard-service
namespace: {{ .Values.namespace }}

spec:
type: LoadBalancer
Expand All @@ -15,6 +16,7 @@ apiVersion: v1
kind: Service
metadata:
name: traefik-web-service
namespace: {{ .Values.namespace }}

spec:
type: LoadBalancer
Expand Down
4 changes: 4 additions & 0 deletions kubernetes/helm-charts/traefik/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace: default

deployment:
image: traefik:3