[Container-tools] [openshift-sme] DNS K8s Service issue with openshift 3.7 on minishift

Elvadas Nono Woguia enonowog at redhat.com
Fri Dec 8 14:55:57 UTC 2017


Hi Charles,

 I have the same issue with v1.7.0+204ce19

MacBook-Pro-de-elvadas:~ enonowog$ minishift version
minishift v1.7.0+204ce19
CDK v3.2.0-1

MacBook-Pro-de-elvadas:~ enonowog$ oc get svc
NAME          CLUSTER-IP       EXTERNAL-IP   PORT(S)
AGE
personneapi   172.30.239.246   <none>        8080/TCP,8443/TCP,8778/TCP   7d
personnedb    172.30.126.240   <none>        27017/TCP
                  7d
MacBook-Pro-de-elvadas:~ enonowog$ oc get pods
NAME                  READY     STATUS    RESTARTS   AGE
personneapi-1-mbntk   1/1       Running   0          7d
personnedb-2-kg3qk    1/1       Running   0          7d

MacBook-Pro-de-elvadas:~ enonowog$ oc rsh personneapi-1-mbntk

sh-4.2$ curl localhost:8080/Personne/
[{"ref":"001","firstName":"TestPV","lastName":"Test","birthDate":null,"customTag":null}]

sh-4.2$
sh-4.2$ curl http://personneapi:8080/Personne/
^C
sh-4.2$
sh-4.2$ ping personneapi
sh: ping: command not found
sh-4.2$ curl 172.30.239.246:8080/Personne/
^C

sh-4.2$ cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
172.17.0.15 personneapi-1-mbntk


sh-4.2$ curl 172.17.0.15:8080/Personne/
[{"ref":"001","firstName":"TestPV","lastName":"Test","birthDate":null,"customTag":null}]
sh-4.2$




On Fri, Dec 8, 2017 at 3:35 PM, Charles Moulliard <cmoullia at redhat.com>
wrote:

> Name is resolved correctly as I can execute ping say-service or ping
> greeting-service and I will get an ip address
> I suspect here a iptables config issue ....
>
>
> On Fri, Dec 8, 2017 at 3:21 PM, Akram Ben Aissi <abenaiss at redhat.com>
> wrote:
>
>> Hi Charles,
>>
>> what if you use the service IP: 172.30.197.92 ?
>>
>> you can check name resolution also with: getent hosts say-service
>>
>>
>> On Fri, Dec 8, 2017 at 9:59 AM, Charles Moulliard <cmoullia at redhat.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I can't curl anymore a kube service using the service address with
>>> Openshift 3.7 within the terminal of a pod/container.
>>>
>>> Is there something broken/changed with internal DNS Server used by k8s
>>> since openshift 3.6 ?
>>>
>>> Here is the scenario followed to install Openshift, Demo project
>>>
>>> # Setup minishift with Openshift
>>> minishift version
>>> minishift v1.9.0+a511b25
>>>
>>> minishift --profile istio-demo config set image-caching true
>>> minishift --profile istio-demo config set memory 3GB
>>> minishift --profile istio-demo config set openshift-version v3.7.0
>>> minishift --profile istio-demo config set vm-driver xhyve
>>> minishift --profile istio-demo addon enable admin-user
>>> minishift start --profile istio-demo
>>>
>>> # Log and install the demo
>>> oc login -u admin -p admin
>>>
>>> pushd $(mktemp -d)
>>> git clone git at github.com:snowdrop/spring-boot-quickstart-istio.git &&
>>> cd spring-boot-quickstart-istio
>>> oc new-project demo
>>> cd greeting-service
>>> mvn clean package fabric8:deploy -Popenshift
>>> cd ../say-service
>>> mvn clean package fabric8:deploy -Popenshift
>>>
>>> sleep 15s
>>> oc get svc/say-service -o yaml
>>> apiVersion: v1
>>> kind: Service
>>> metadata:
>>>   labels:
>>>     app: say-service
>>>     expose: "true"
>>>     group: me.snowdrop
>>>     provider: fabric8
>>>     version: 1.0-SNAPSHOT
>>>   name: say-service
>>>   namespace: demo
>>> spec:
>>>   clusterIP: 172.30.197.92
>>>   ports:
>>>   - name: http
>>>     port: 8080
>>>     protocol: TCP
>>>     targetPort: 8080
>>>   selector:
>>>     app: say-service
>>>     group: me.snowdrop
>>>     provider: fabric8
>>>   sessionAffinity: None
>>>   type: ClusterIP
>>> status:
>>>   loadBalancer: {}
>>>
>>> # Rsh to the container
>>>
>>> oc rsh $(oc get pods -o jsonpath='{.items[*].metadata.name}' -l
>>> app=say-service)
>>> sh-4.2$ curl http://localhost:8080/say
>>> {"id":7,"content":"Hello, World!"}
>>>
>>> sh-4.2$ curl http://$HOSTNAME:8080/say
>>> {"id":8,"content":"Hello, World!"}sh-4.2
>>>
>>> $ podIP=$(grep `hostname` /etc/hosts | awk '{print $1}')
>>> sh-4.2$ echo $podIP
>>> 172.17.0.14
>>> sh-4.2$ curl  $podIP:8080/say
>>> {"id":9,"content":"Hello, World!"}
>>>
>>> ##### FAIL TO REPLY #######
>>> sh-4.2$ curl http://say-service.demo.svc.cluster.local:8080/say
>>> ^C
>>> sh-4.2$ curl http://say-service:8080/say
>>> ^C
>>>
>>> Regards,
>>>
>>> Charles
>>>
>>>
>>> Have a question?
>>> First, check the FAQ: https://pnt.redhat.com/pnt/p-7
>>> 34673/openshift-con...-Jun-2017.pdf
>>> Next, check the archives: http://post-office.corp.redhat
>>> .com/archives/openshift-sme/
>>>
>>
>>
>>
>> --
>>
>> Akram Ben Aissi                         Mob : +33 6 31 57 08 60 <+33%206%2031%2057%2008%2060>
>> Cloud and Platform Architect            Mel : akram.benaissi at redhat.com
>> Red Hat Global Services                 Irc : akram
>>                                         Twi : @ <akram.benaissi at redhat.com>akrambenaissi
>> Red Hat France SARL                     http://www.redhat.fr
>>
>>
>
> Have a question?
> First, check the FAQ: https://pnt.redhat.com/pnt/p-
> 734673/openshift-con...-Jun-2017.pdf
> Next, check the archives: http://post-office.corp.
> redhat.com/archives/openshift-sme/
>



-- 
--
*Nono Elvadas*
Consultant
Email: elvadas.nono at redhat.com <enonowog at redhat.com>
Mobile: 33 (0)7 76 88 95 80 <+33+(0)7+76+88+95+80>
https://developers.redhat.com/blog/author/elvadasnono/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/container-tools/attachments/20171208/6657e402/attachment.htm>


More information about the Container-tools mailing list