Hi Everyone,
I tried to set up a quick microK8s cluster on my local machine to introduce Kubernetes in a meetup on my company. So I create a little helloworld webservice with Springboot with 2 entrypoints and some actuator entrypoints
I deployed my app on my microk8s cluster with some resources yaml files:
This is my microk8s configuration:
microk8s.kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:02:58Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
microk8s.status --yaml
microk8s:
running: true
addons:
jaeger: disabled
fluentd: disabled
gpu: disabled
storage: disabled
registry: disabled
ingress: enabled
dns: enabled
metrics-server: disabled
prometheus: disabled
istio: disabled
dashboard: enabled
And my app configuration:
- Ingress
microk8s.kubectl describe ingress hello-world-ingress
Name: hello-world-ingress
Namespace: default
Address:
Default backend: default-http-backend:80 (<none>)
Rules:
Host Path Backends
---- ---- --------
localhost
/* hello-world-service:81 (10.1.1.19:8080,10.1.1.20:8080)
Annotations:
kubectl.kubernetes.io/last-applied-configuration: {"apiVersion":"networking.k8s.io/v1beta1","kind":"Ingress","metadata":{"annotations":{"ingress.kubernetes.io/rewrite-target":"/*","kubernetes.io/ingress.class":"nginx-int"},"name":"hello-world-ingress","namespace":"default"},"spec":{"rules":[{"host":"localhost","http":{"paths":[{"backend":{"serviceName":"hello-world-service","servicePort":81},"path":"/*"}]}}]}}
kubernetes.io/ingress.class: nginx-int
ingress.kubernetes.io/rewrite-target: /*
Events: <none>
- Service
microk8s.kubectl describe service hello-world-service
Name: hello-world-service
Namespace: default
Labels: app=hello-world
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"hello-world"},"name":"hello-world-service","namespace":"...
Selector: app=hello-world
Type: ClusterIP
IP: 10.152.183.140
Port: hello-world 81/TCP
TargetPort: 8080/TCP
Endpoints: 10.1.1.19:8080,10.1.1.20:8080
Session Affinity: None
Events: <none>
- Deployment
microk8s.kubectl describe deployment hello-world-deployment
Name: hello-world-deployment
Namespace: default
CreationTimestamp: Wed, 29 May 2019 10:52:07 +0200
Labels: <none>
Annotations: deployment.kubernetes.io/revision: 5
kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"hello-world-deployment","namespace":"default"},"spec":{"r...
Selector: app=hello-world
Replicas: 3 desired | 3 updated | 3 total | 2 available | 1 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 1 max unavailable, 0 max surge
Pod Template:
Labels: app=hello-world
env=prod
version=0.2.0-SNAPSHOT
Containers:
hello-world:
Image: winael/hello-world:0.2.0-SNAPSHOT
Port: 8080/TCP
Host Port: 0/TCP
Limits:
cpu: 500m
memory: 200Mi
Requests:
cpu: 100m
memory: 100Mi
Liveness: http-get http://:8080/actuator/health delay=120s timeout=1s period=10s #success=1 #failure=3
Readiness: http-get http://:8080/actuator/health delay=120s timeout=1s period=10s #success=1 #failure=3
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: hello-world-deployment-899dffddb (3/3 replicas created)
Events: <none>
When I call an endpoint to the webservice using the IP defined in the service resource (10.152.183.140
) on port 81
, it’s working fine, but when I try to call it from localhost
on port 80
as it is defined on Ingress, I have a default backend - 404
I suppose I didn’t set correctly my ingress but don’t understand what’s happening. Can someone help me on this ?
Regards,
Vincent J