I have set up a front-end service via the following svc and deployment:
Deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ui-deployment
spec:
replicas: 1
template:
metadata:
labels:
els-pod: ui
spec:
containers:
- image: pkaramol/the-ui
name: ui
ports:
- containerPort: 80
restartPolicy: Always
Service
apiVersion: v1
kind: Service
metadata:
name: ui
spec:
ports:
- name: ui-port
port: 8080
targetPort: 80
selector:
els-pod: ui
When exposing via an AWS ELB as follows:
kubectl expose deployment ui-deployment --type=LoadBalancer --port=80 --target-port=8080 --name=k8s-elb
I get an empty page when accessing ELB's dns name.
Furthermore, the instances behind the elb seem unhealthy:
You may need some additions to your service yaml file -
Add loalbalancer Ip and type in Service yaml
loadBalancerIP: <Public Ip> type: LoadBalancer
Refrence - https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip
Set your service type to LoadBalancer
: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#external-load-balancer-providers
apiVersion: v1
kind: Service
metadata:
name: ui
spec:
type: LoadBalancer
ports:
- name: ui-port
port: 8080
targetPort: 80
selector:
els-pod: ui
You do not need to set a load balancer IP.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.