Reputation: 1
I've deployed a pod in AKS and I'm trying to connect to my service through a public IP. When I check my service from kubectl command or K8 dashboard, my deployments are successful. Service and Pod are running perfectly.
When I want to access my public IP with port, my service is not responding. My public IP and port are already displayed in the correct Azure Network Security Group.
Do I need add any additional settings in Azure side?
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: sample-service
spec:
replicas: 1
template:
metadata:
labels:
app: sample-service
spec:
containers:
- name: sample-service
image: container/sample-service:#{Build.BuildId}#
ports:
- containerPort: 80
name: sample-service
dnsPolicy: xxxxx
restartPolicy: Always
apiVersion: v1
kind: Service
metadata:
name: sample-service
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: sample-service
Upvotes: 0
Views: 1490
Reputation: 31414
For your issue, the possible reason is that you did not set the targetPort
in the service. So you could try to change the service like below:
apiVersion: v1
kind: Service
metadata:
name: sample-service
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 80
name: sample-service
selector:
app: sample-service
Then re-create the service again.
Upvotes: 0