I m using Minikube for kubernetes deployment and Operating system i m using is Ubuntu 18.04
I have a Deployment of my application with 3 replicas. So when i deploy 3 pods gets deployed . when i increase the number of http request all the request are forwarded to the a single pod while there are no logs recorded in the other two replicas.
Any ideas on how the load get distributed across all the pods.
i have the deployment.yaml and respective service.yaml file below
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: master
labels:
app: master-container
spec:
selector:
matchLabels:
app: master-container
replicas: 3
template:
metadata:
labels:
app: master-container
spec:
volumes:
- name: logs-dir
hostPath:
path: /data/logs/
type: DirectoryOrCreate
containers:
- name: master-container
image: image:1
volumeMounts:
- mountPath: /data/workspace/logs/
name: logs-dir
service.yaml
apiVersion: v1
kind: Service
metadata:
name: master-container
labels:
app: master-container
spec:
selector:
app: master-container
ports:
- port: 2000
protocol: TCP
targetPort: 2000
name: can-port
nodePort: 32000
- port: 2002
protocol: TCP
targetPort: 2002
name: can-ajp-port
nodePort: 32002
- port: 2003
protocol: TCP
targetPort: 2003
name: cas-port
nodePort: 32003
- port: 2005
protocol: TCP
targetPort: 2005
name: cas-ajp-port
nodePort: 32005
- port: 31900
protocol: TCP
targetPort: 31900
name: cas-master-port
nodePort: 31900
type: NodePort
Have a look at the below image this is the output of the command
kubectl describe svc canmastercontainer
We can see that service is up and all the ports are accessible . The only issue i m facing is that the load distribution is not happening across the pods
i have tried giving type as NodePort , LoadBalancer and ClusterIp all the three didnt work out . All the http request are getting transferred to the single pod .
Any solutions would be appriciated thank you