Reads:43443Replies:3
Connect back-end with front-end over rest api call running on kubernetes
I have a two tier application. The frontend calls the webapi layer through simple http rest call http://mywebapi:5000/ My working docker compose code is below and the application works
version: '3' services: webfrontend: image: webfrontend build: ./nodeexpress-alibaba-ci-tutorial ports: - "3000:3000" networks: - my-shared-network mywebapi: image: mywebapi build: ./dotnetcorewebapi-alibaba-ci-tutorial ports: - "5000:5000" networks: - my-shared-network networks: my-shared-network: {} Now I'm trying to get this to work on kubernetes. I have created two deployments and two services-loadbalancer for webfrontend and clusterip for mywebapi But, after deploying, I find that the data from mywebapi is not reaching the frontend. I can view the frontend on the browser through the load balancer public ip. Mywebapi deployment yaml apiVersion: apps/v1beta2 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: '2' creationTimestamp: '2019-09-29T15:21:42Z' generation: 2 labels: app: mywebapi-default name: mywebapi-default namespace: default resourceVersion: '667574310' selfLink: /apis/apps/v1beta2/namespaces/default/deployments/mywebapi-default uid: d723a9d5-e2cc-11e9-93ec-a65f0b53b1fa spec: progressDeadlineSeconds: 600 replicas: 2 revisionHistoryLimit: 10 selector: matchLabels: app: mywebapi-default strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: labels: app: mywebapi-default spec: containers: - image: >- registry-intl-vpc.ap-southeast-1.aliyuncs.com/devopsci-t/mywebapi:1.0 imagePullPolicy: Always name: mywebapi-default resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 status: availableReplicas: 2 conditions: - lastTransitionTime: '2019-09-29T15:30:25Z' lastUpdateTime: '2019-09-29T15:30:25Z' message: Deployment has minimum availability. reason: MinimumReplicasAvailable status: 'True' type: Available - lastTransitionTime: '2019-09-29T15:21:42Z' lastUpdateTime: '2019-09-29T15:30:25Z' message: ReplicaSet "mywebapi-default-647b864f" has successfully progressed. reason: NewReplicaSetAvailable status: 'True' type: Progressing observedGeneration: 2 readyReplicas: 2 replicas: 2 updatedReplicas: 2 Mywebapi service yaml apiVersion: v1 kind: Service metadata: creationTimestamp: '2019-09-29T15:21:44Z' name: mywebapi-svc namespace: default resourceVersion: '667545270' selfLink: /api/v1/namespaces/default/services/mywebapi-svc uid: d84503ee-e2cc-11e9-93ec-a65f0b53b1fa spec: clusterIP: 172.19.0.74 ports: - name: mywebapiport port: 5000 protocol: TCP targetPort: 5000 selector: app: mywebapi-default sessionAffinity: None type: ClusterIP status: loadBalancer: {} I even tried updating the http rest call url to http://mywebapi-svc:5000/ but still does not work. In the webfrontend pod logs I find the below error Got error: getaddrinfo ENOTFOUND mywebapi-svc mywebapi-svc:5000 Sincerely appreciate all help Thanks |
|
1st Reply#
Posted time:Oct 11, 2019 10:53 AM
Dear arnab74,
Please create a ticket in your Alibaba Cloud console and our post-sales team will help you with that. You can refer to the below link for the instruction of creating ticket: https://www.alibabacloud.com/help/doc-detail/47605.htm#ticket Thank you. |
|
2nd Reply#
Posted time:Mar 12, 2020 1:15 AM
Hi arnab74,
Have you try something like this before? https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/ |
|
3rd Reply#
Posted time:May 16, 2022 22:41 PM
Thanks for the link. I am also facing the same issue and I want to solve it. I don't have time to find its solution online because I have a lot of assignments to do. But thanks to my friend who shared the https://www.grabmyessay.com/dissertation-editing-service website with me in which I found a lot of essay samples and the best part is, I don't have to pay anything to read those essay samples.
[StevenClinton edited the post at May 23, 2022 14:12 PM]
|
|