Closed arthurdrabazha closed 4 years ago
The one critical thing in all of the k8s objects is the names of the services, as these become dns names for service discovery and that's how the pods find each other.
So the simulator is looking for "fleetman-queue", you've called it "queue" so the dns lookup will fail.
Here's the full yaml for reference:
apiVersion: v1
kind: Service
metadata:
name: fleetman-webapp
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: webapp
ports:
- name: http
port: 80
nodePort: 30080
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-queue
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: queue
ports:
- name: http
port: 8161
nodePort: 30010
- name: endpoint
port: 61616
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-position-tracker
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: position-tracker
ports:
- name: http
port: 8080
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-api-gateway
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: api-gateway
ports:
- name: http
port: 8080
nodePort: 30020
type: NodePort
Where exactly written instruction for simulator to look for "fleetman-queue"? And can I change it somehow?
Does it requires rebuilding of dockerfiles. Or it needs changes actually in k8s?
For example the position simulator gets its url here:
To change it you'd need to clone the project, change it, build and and upload your new images to dockerhub or similar.
Really these projects are just intended to be prebuilt images for the course so that viewers don't need to bother building their own images, so on the course I direct the students to use the service names to match the code rather than the other way around.
For reference the yaml files as they are at the end of each chapter of the training course are here: https://github.com/DickChesterwood/k8s-fleetman/tree/master/_course_files
Now I understand. Thanks for your help.
Hi, i'm on your k8s course
Have some problem when check queue via browser, it's just dont show any activity
My YAML files:
apiVersion: apps/v1 kind: Deployment metadata: name: position-simulator spec: replicas: 1 selector: matchLabels: app: position-simulator template: metadata: labels: app: position-simulator spec: containers:
name: position-simulator image: richardchesterwood/k8s-fleetman-position-simulator:release1 env:
name: SPRING_PROFILES_ACTIVE value: production-microservice
apiVersion: apps/v1 kind: Deployment metadata: name: queue spec: replicas: 1 selector: matchLabels: app: queue template: metadata: labels: app: queue spec: containers:
apiVersion: v1 kind: Service metadata: name: webapp-service spec: selector: app: webapp ports:
name: http port: 80
type: NodePort
apiVersion: v1 kind: Service metadata: name: queue spec: selector: app: queue ports:
name: admin port: 8161
name: endpoint port: 61616
type: NodePort
Position simulator logs:
. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v1.4.0.RELEASE)
2020-02-03 13:42:42.890 INFO 1 --- [ main] c.v.s.PositionsimulatorApplication : Starting PositionsimulatorApplication v0.0.1-SNAPSHOT on position-simulator-7d555dc46-9ddsg with PID 1 (/webapp.jar started by root in /) 2020-02-03 13:42:42.903 INFO 1 --- [ main] c.v.s.PositionsimulatorApplication : The following profiles are active: production-microservice 2020-02-03 13:42:43.071 INFO 1 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@443b7951: startup date [Mon Feb 03 13:42:43 UTC 2020]; root of context hierarchy 2020-02-03 13:42:44.926 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2020-02-03 13:42:44.934 INFO 1 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647 2020-02-03 13:42:44.950 INFO 1 --- [ main] c.v.s.PositionsimulatorApplication : Started PositionsimulatorApplication in 2.788 seconds (JVM running for 4.043) 2020-02-03 13:42:44.951 INFO 1 --- [ main] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@443b7951: startup date [Mon Feb 03 13:42:43 UTC 2020]; root of context hierarchy 2020-02-03 13:42:44.954 INFO 1 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 2147483647 2020-02-03 13:42:44.959 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2020-02-03 13:42:46.183 WARN 1 --- [ool-1-thread-31] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.184 WARN 1 --- [ool-1-thread-27] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.189 WARN 1 --- [ool-1-thread-10] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.194 WARN 1 --- [ool-1-thread-11] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.194 WARN 1 --- [ool-1-thread-37] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.194 WARN 1 --- [ool-1-thread-14] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [pool-1-thread-1] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [ool-1-thread-34] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [ool-1-thread-15] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [ool-1-thread-25] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [ool-1-thread-30] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [ool-1-thread-19] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [ool-1-thread-20] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [ool-1-thread-26] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.195 WARN 1 --- [ool-1-thread-38] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.201 WARN 1 --- [ool-1-thread-18] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.202 WARN 1 --- [ool-1-thread-23] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry 2020-02-03 13:42:46.202 WARN 1 --- [ool-1-thread-21] c.v.simulator.journey.Journey : Queue unavailable - backing off 5000ms before retry
...and so on.
P.S One thing, when i'm trying to find your images on DockerHub search can't find nothing. But
docker pull
works fine.P.P.S Can this application work in Brave browser?