I tried different port, still getting the issue also when I restart the server inside the second application pod, I can see the website live for the second application but not for the first one. do you know of any tutorial or a sample yaml files for a similar case that I can follow and try to work with ?
On Thursday, March 2, 2017 at 9:41:18 PM UTC-5, Cole Mickens wrote: > > The two containers share a network namespace, so each application needs to > listen on a different port, they can't both bind to port 80. > > On Thu, Mar 2, 2017 at 6:36 PM, Montassar Dridi <[email protected] > <javascript:>> wrote: > >> I'm trying to create two containers (tomact image) inside my web pod: >> each one going to run a java application but I want them to share the >> same ip address >> >> apiVersion: extensions/v1beta1 >> kind: Deployment >> metadata: >> name: web-dp >> labels: >> name: web-pod >> version: v1 >> spec: >> template: >> metadata: >> labels: >> name: web-pod >> version: v1 >> spec: >> containers: >> - image: gcr.io/projectid/webapp:1 >> name: web-pod >> ports: >> - containerPort: 8080 >> - image: gcr.io/projectid/webapp:2 >> name: crm-pod >> ports: >> - containerPort: 8081 >> ------------- >> apiVersion: v1 >> kind: Service >> metadata: >> name: web-service >> labels: >> name: web-pod >> version: v1 >> spec: >> type: NodePort >> ports: >> - port: 80 >> targetPort: 8080 >> protocol: TCP >> name: app1 >> nodePort: 30531 >> - port: 80 >> targetPort: 8081 >> protocol: TCP >> name: app2 >> nodePort: 31352 >> selector: >> name: web-pod >> >> I'm using an NGINX-ingress-controller+Ingress for the service >> >> apiVersion: extensions/v1beta1 >> kind: Ingress >> metadata: >> name: amenity-smartlab-ing >> annotations: >> kubernetes.io/ingress.class: "nginx" >> spec: >> rules: >> - http: >> paths: >> - backend: >> >> serviceName: web-service >> servicePort: 80 >> path: / >> >> I get this error in my logs >> java.lang.Exception: Socket bind failed: [98] *Address* already in use >> <https://www.google.ca/search?q=java.lang.Exception%3A+Socket+bind+failed%3A+%5B98%5D+Address+already+in+use&oq=java.lang.Exception%3A+Socket+bind+failed%3A+%5B98%5D+Address+already+in+use&aqs=chrome..69i57j69i60&sourceid=chrome&ie=UTF-8#q=kubernetes+Socket+bind+failed:+%5B98%5D+Address+already+in+use&*> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Kubernetes user discussion and Q&A" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/kubernetes-users. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/kubernetes-users. For more options, visit https://groups.google.com/d/optout.
