Kubernetes service not working (Timing out)

6/26/2017

My service is not connecting/directing traffic to pod. I have 'sshed' into the pod and the server is working properly but the service times out.

Deployment File:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: venues
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  minReadySeconds: 5
  template:
    metadata:
      labels:
        app: venues
        version: v0.3
    spec:
      containers:
      - name: venues
        image: some-image
        imagePullPolicy: Always
        ports:
          - containerPort: 3000
          name: http-server

Service File:

apiVersion: v1
kind: Service
metadata:
  name: venues
  labels:
    name: venues
spec:
  type: LoadBalancer
  ports:
    - port: 3000
      targetPort: 3000
      protocol: TCP
  selector:
    name: venues
-- Nathan Horrigan
google-cloud-platform
google-kubernetes-engine
kubectl
kubernetes

1 Answer

6/27/2017

Your selector in the service is wrong: you need to select a label of the deployment, not the container name. So

selector:
  app: venues

should work. Optionally you could add also version: v0.3 if needed.

-- slintes
Source: StackOverflow