I'm creating a plain vanilla AKS cluster with an ACR container registry and deploying a dummy service, something I've done a number of times before and should work but it's not - the service deploys without errors, I see the pod and the service are alive, the ports seem to match - but I fail to reach the app running in the pod.
Here is my YAML file:
<!-- language: lang-yaml -->apiVersion: v1
kind: Service
metadata:
name: dummyapp-prep
spec:
selector:
app: dummyapp-prep
ports:
- protocol: TCP
port: 80
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dummyapp-prep
spec:
selector:
matchLabels:
run: dummyapp-prep
replicas: 1
template:
metadata:
labels:
run: dummyapp-prep
spec:
containers:
- name: dummyapp-prep
image: dummyappregistry.azurecr.io/dummyappregistry.azurecr.io/dummyapp-prep:dummyapp-prep-18
ports:
- containerPort: 80
imagePullSecrets:
- name: secret
Everything deploys fine - I see the service and it gets an external IP:
kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
dummyapp-prep LoadBalancer 10.0.230.4 52.149.106.85 80:32708/TCP 4m24s
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 26h
The pod is fine, I connect to it and curl the app on localhost:80. Still, browsing http://52.149.106.85:80 timeouts
I check the Azure Load Balancer - the IP is registered.
What else could be wrong?
You have the wrong label applied. Service is looking for app: dummyapp-prep
while the pod and deployment have run: dummyapp-prep
. Notice run
vs app
label names.
You can also check if the service is bound by checking the endpoint object the API server creates for you by running kubectl describe endpoints dummyapp-prep
. If it doesn't list the pod IPs in the Subsets
section then it would mean the service can't find the pods.