Comments (14)
Can you provide a github project as a sample for us to look at and be able to check it out to reproduce the problem? It has to be a minimal reproducible example. Thank you.
from spring-cloud-kubernetes.
@wind57 Sure, this is the link for my repository: https://github.com/Deimos177/spring-cloud-graalvm
from spring-cloud-kubernetes.
Hello @wind57, there a way more simple example to test: https://github.com/Deimos177/spring-kubernetes isn't working either.
from spring-cloud-kubernetes.
If a downgrade to spring cloud version 2021.0.9 the error disapear.
from spring-cloud-kubernetes.
I am a bit stuck with other things, but I'll get to this one.
from spring-cloud-kubernetes.
Okay, don't worry, take your time, i'll be waiting when you can.
from spring-cloud-kubernetes.
Regarding this : https://github.com/Deimos177/spring-kubernetes
There were things I had to adjust:
- your instructions were missing the point about creating the
study
namespace - include logback as dependency, otherwise there were no logs
- include build-image goal in the maven plugin, otherwise I could not build the image locally
- your
cm.yaml
is invalid - You were missing
hostPort: 8080
, and I could not access your end-point.
I fixed the above in this branch, deployed, then I exec into my k8s cluster:
kubectl get pods -o wide
then issue : curl 10.244.0.8:8080/hello
and see : "Hello from kubernetes".
I can not re-produce your issue. Unless you tell me exactly how to do it against that branch I pushed, I can't really help you.
from spring-cloud-kubernetes.
After you review what I did in that branch, ask yourself where that "message" ("Hello from kubernetes"
) is really coming from, because you do not have it in cm.yaml
under application.yml
(again, in that branch I pushed). So your example is kind of miss-leading to me. Nevertheless, I'll gladly wait for your feedback for me to understand how to re-produce that issue, if there is any issue at all :)
from spring-cloud-kubernetes.
I merged your PR, yeah a configure the cm.yaml with message=${MESSAGE} instead message: ${message}.
This make the application work, but the context-path isn't working properly, but i've made some changes in the project and seens to work as expected.
about the docker image, i build the project with a custom image with de Dockerfile in the root, because a need some customizations that the default spring image builder don't provider.
i changed the spring-cloud-kubernetes dependency to this:
org.springframework.cloud
spring-cloud-starter-kubernetes-config
1.0.2.RELEASE
and the error disapear.
i added the context-path in the application.yml instead the configmap, inject as an envrioment var and then it worked.
i'll commit my changes and try again later with the spring-cloud-kubernetes default starter, because with it the error come back.
from spring-cloud-kubernetes.
Hello, i'm here again, so, i made some changes in the source project of this issue, using the starters from the oficial docs from spring cloud, ignoring the error from the yaml and trying to deploy the application in my minikube cluster, my app is unable to load the spring properties from configmap, and the error reported in this issue persist.
you can check this project https://github.com/Deimos177/spring-cloud-poc and reproduce the issue from there.
from spring-cloud-kubernetes.
I tried many solutions, my last try was read the config properties from mounted file in /etc/config/application.yml, but the none of my properties have being loaded, is extremely strange, because if a define some custom property as message: ${MESSAGE}, the configmap propertySource just work, but if i use some of the default spring properties as:
spring:
application:
name: cloud-jpa
datasource:
password: ${DB_PASSWORD}
url: ${DB_URL}
username: ${DB_USER}
jpa:
generate-ddl: true
hibernate:
ddl-auto: update
show-sql: true
profiles:
active: dev
none of these are loaded.
from spring-cloud-kubernetes.
I'll take a look in the upcoming days at this. thank you
from spring-cloud-kubernetes.
Hello, i think this is the last update,i made several changes in the project and finally it worked.
one of these is in the pom.xml to the following format:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://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.2.2</version>
<relativePath />
</parent>
<groupId>br.com.deimos</groupId>
<artifactId>cloud-jpa</artifactId>
<version>1.0.4</version>
<name>cloudjpa</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>21</java.version>
<spring-cloud.version>2023.0.0</spring-cloud.version>
<log4j2.version>2.17.1</log4j2.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<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>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-fabric8-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-fabric8</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
and cleaned the application.yml and inserted all in the bootstrap.yml to looks like this:
spring:
application:
name: cloud-jpa
cloud:
kubernetes:
config:
enabled: true
reload:
enabled: true
monitoring-config-maps: true
strategy: refresh
mode: event
then it works like magic hehehehe.
Thanks for all the support during this time and if you want to look at my project feel free,
One more time, thanks a lot for all!!!
from spring-cloud-kubernetes.
well as long as it works for you, we are happy too :) feel free to close the issue then
from spring-cloud-kubernetes.
Related Issues (20)
- In rare scenarios ConfigMap update is not updated using polling strategy HOT 9
- load balancer SERVICE implementation HOT 1
- support running Fabric8IstioIT with colima HOT 7
- Future status of the `PropertySource Reload` feature HOT 1
- Importing kubernetes: config doesn't work as document with YAML config HOT 4
- config server default profile issue HOT 5
- User "system:serviceaccount:default:mockup" cannot list resource "services" in API group "" in the namespace "default" HOT 7
- Cannot find service - SERVICE_UNAVAILABLE HOT 17
- Dependency convergence fails for spring-cloud-starter-kubernetes-client-config ver 3.1.1 HOT 5
- [els.V1Service-1] i.k.c.informer.cache ReflectorRunnable : class io.kubernetes.client.openapi.models.V1Service#Reflector loop failed unexpectedly HOT 9
- Support arm64 when running integration tests HOT 10
- Caused by: io.kubernetes.client.openapi.ApiException HOT 11
- No qualifying bean of type 'io.kubernetes.client.informer.SharedInformerFactory' HOT 3
- KubernetesReactiveDiscoveryClient cache configuration issues HOT 7
- Cannot connect to remote service - SERVICE_UNAVAILABLE HOT 18
- Migrate @RibbonClient for spring-cloud-starter-kubernetes-discoveryclient HOT 3
- [QUESTION] Different behaviour kubernetes-client-config / kubernetes-client-all HOT 9
- How to disable the `kubernetes` profile? HOT 3
- Allow using Watcher when ConfigMaps and Secrets are maintained by external team HOT 15
- Fabric8 LeaderProperties.getNamespace(defaultValue) no longer falls back to given default when namespace is undefined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-kubernetes.