Nathan Horrigan
Nathan Horrigan

Reputation: 813

Kubernetes service not working (Timing out)

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

Upvotes: 1

Views: 133

Answers (1)

slintes
slintes

Reputation: 770

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.

Upvotes: 3

Related Questions