So both services are running and command service is reaching the axon server. But when I send post to my command service I'm not able to reach it out.
Actually, if I send
POST http://localhost:8081/bowl
I expect to get
yes, you have a bowl, etc...
here is my axon server's yml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: axonserver
labels:
app: axonserver
spec:
serviceName: axonserver
replicas: 1
selector:
matchLabels:
app: axonserver
template:
metadata:
labels:
app: axonserver
spec:
containers:
- name: axonserver
image: axoniq/axonserver
imagePullPolicy: Always
ports:
- name: grpc
containerPort: 8124
protocol: TCP
- name: gui
containerPort: 8024
protocol: TCP
readinessProbe:
httpGet:
port: 8024
path: /actuator/health
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 1
env:
- name: AXONSERVER_HOSTNAME
value: axonserver
---
apiVersion: v1
kind: Service
metadata:
name: axonserver-gui
labels:
app: axonserver-gui
spec:
ports:
- name: gui
port: 8024
targetPort: 8024
selector:
app: axonserver
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
name: axonserver
labels:
app: axonserver
spec:
ports:
- name: grpc
port: 8124
targetPort: 8124
clusterIP: None
selector:
app: axonserver
And this my command service yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: command-service
spec:
selector:
matchLabels:
app: axonserver
tier: backend
replicas: 1
template:
metadata:
labels:
app: axonserver
tier: backend
spec:
containers:
- name: command-svc
image: celcin/command-svc
env:
- name: AXONSERVER_HOSTNAME
value: axonserver
ports:
- containerPort: 8081
---
apiVersion: v1
kind: Service
metadata:
name: command-service
labels:
app: axonserver
tier: backend
spec:
type: NodePort
ports:
- port: 8081
selector:
app: axonserver
tier: backend
I am a bit confused in the Kubernetes world. Which point of config file should be changed then
Here also how they are looks like
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
axonserver ClusterIP None <none> 8124/TCP 25m app=axonserver
axonserver-gui LoadBalancer 10.103.181.173 <pending> 8024:31755/TCP 25m app=axonserver
command-service NodePort 10.109.18.71 <none> 8081:30515/TCP 23m app=axonserver,tier=backend
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 33m <none>
Nodeport normally allocates a port in the range between 30000-32767. Check the Nodeport service to see if it is really serving on 8081.
kubectl get svc command-service -o yaml
with NodePort
or ClusterIP
, you can access to the pods
using :
curl -k -v http://10.109.18.71:8081/bowl
or POST http://10.109.18.71:8081/bowl
for POST http://localhost:8081/bowl
,
you have to build up kube proxy
or use ingress
for connection from outside.