I´ve created two service connections (nodeports) at my pod storage for communicating with the pod app via port 8885 and 8881. I´ve read that I need to use matchselects on the app deployment with the same name, which I gave the nodeport. Can you please show me an working example, where pod app can reach pod storage on port 8881 and 8885?
I´ve tested telnet demo-storage-manageport 8885 and demo-storage-nodeport 8881 within the app container (docker), but it doesn´t work.
Service Connections:
apiVersion: v1
kind: Service
metadata:
name: demo-storage-nodeport
namespace: demo-customer
labels:
run: demo-storage
spec:
type: NodePort
ports:
- port: 8881
targetPort: 8881
protocol: TCP
name: tomcat-http
selector:
app: demo-app
---
apiVersion: v1
kind: Service
metadata:
name: demo-storage-manageport
namespace: demo-customer
labels:
run: demo-storage
spec:
type: NodePort
ports:
- port: 8885
targetPort: 8885
protocol: TCP
name: tomcat-http
selector:
app: demo-app
Deployments:
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-app
namespace: demo-customer
labels:
app: demo-app
name: appserver
spec:
selector:
matchLabels:
app: demo-app
customer: demo-customer
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: demo-app
customer: demo-customer
spec:
containers:
- name: appserver
image: xy.azurecr.io/client/demo-customer-app:latest
ports:
- containerPort: 8080
imagePullSecrets:
- name: xy
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-storage
namespace: demo-customer
labels:
app: demo-storage
name: storageserver
spec:
selector:
matchLabels:
app: demo-storage
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: demo-storage
spec:
volumes:
- name: shared-config
emptyDir: {}
containers:
- name: storageserver
image: xy.azurecr.io/client/demo-customer-storage:latest
ports:
- containerPort: 8881
imagePullSecrets:
- name: xy