Welcome to the Linux Foundation Forum!

Lab 2.3 Connection Failure for Service

Options
wallace
wallace Posts: 1
edited February 2019 in LFD259 Class Forum

I took down the single pod and created/edited the basicservice.yaml and basic.yaml files.
I ran create for the pod and then the service as instructed.
It all looks okay:

NAME           READY   STATUS    RESTARTS   AGE
pod/basicpod   1/1     Running   0          13m

NAME                   TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/basicservice   ClusterIP   10.102.33.90   <none>        80/TCP    13m
service/kubernetes     ClusterIP   10.96.0.1      <none>        443/TCP   17h

However when I try to reach the service at the cluster-ip:

curl 10.102.33.90
curl: (7) Couldn't connect to server

But curling the pod directly seems to work:

get pod -o wide
NAME       READY   STATUS    RESTARTS   AGE   IP             NODE     NOMINATED NODE   READINESS GATES
basicpod   1/1     Running   0          16m   192.168.1.10   worker   <none>           <none>
curl 192.168.1.10
<!DOCTYPE html> ...

Does anyone have any suggestions about what I can do to solve/diagnosis this problem?
Thanks!

Here are the yaml contents:

$ cat basic.yaml
apiVersion: v1
kind: Pod
metadata:
  name: basicpod
  labels:
    type: websever
spec:
  containers:
    - name: webcont
      image: nginx
      ports:
      - containerPort: 80
$ cat basicservice.yaml
apiVersion: v1
kind: Service
metadata:
  name: basicservice
spec:
  selector:
    type: webserver
  ports:
  - protocol: TCP
    port: 80

Comments

  • chrispokorni
    Options

    Hi @wallace, similar connectivity issues with Lab 2 have been reported earlier in the forum, and most have been resolved with solutions posted in the forum as well.
    Search thru the forum, you may find a situation similar to yours, and most likely resolved.
    These early connectivity issues are not kubernetes related. They are caused by improper infrastructure setup - especially networking.
    Depending on your setup, cloud VMs vs local hypervisor, you may be encountering networking issues between your Nodes/VMs. In the cloud, you may not have created a custom VPC and a custom firewall open to all traffic. Local hypervisors have specific networking settings to allow all traffic between the VMs. You may also have a firewall running on your Nodes blocking some of the traffic.
    Regards,
    -Chris

Categories

Upcoming Training