forked from pivotal-cf/docs-pks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_expose-external-lb.html.md.erb
78 lines (58 loc) · 2.72 KB
/
_expose-external-lb.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#### <a id='external-lb-configure'></a>Configure Your Workload
1. Open your workload's Kubernetes service configuration file in a text editor.
1. To expose the workload through a load balancer, confirm that the Service object is configured to be `type: LoadBalancer`.
<br>
For example:
```
---
apiVersion: v1
kind: Service
metadata:
labels:
name: nginx
name: nginx
spec:
ports:
- port: 80
selector:
app: nginx
type: LoadBalancer
---
```
1. Confirm the workload's Kubernetes service configuration is set to be `type: LoadBalancer`.
1. Confirm the `type` property of each workload's Kubernetes service is similarly configured.
<p class='note'><strong>Note</strong>: For an example of a fully configured Kubernetes service, see the
<a href="https://github.com/cloudfoundry-incubator/kubo-ci/blob/master/specs/nginx-lb.yml">nginx app's example <code>type: LoadBalancer</code> configuration</a> in GitHub. </p>
For more information about configuring the `LoadBalancer` Service type see the
[Kubernetes documentation](https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer).
#### <a id='external-lb-deploy'></a>Deploy and Expose Your Workload
1. To deploy the service configuration for your workload, run the following command:
```
kubectl apply -f SERVICE-CONFIG
```
Where `SERVICE-CONFIG` is your workload's Kubernetes service configuration.
<br>
For example:
<pre class="terminal">kubectl apply -f nginx.yml</pre>
This command creates three pod replicas, spanning three worker nodes.
1. Deploy your applications, deployments, config maps, persistent volumes, secrets,
and any other configurations or objects necessary for your applications to run.
1. Wait until your cloud provider has created and connected a dedicated load balancer to the worker nodes on a specific port.
#### <a id='external-lb-access'></a>Access Your Workload
1. To determine your exposed workload's load balancer IP address and port number, run the following command:
```
kubectl get svc SERVICE-NAME
```
Where `SERVICE-NAME` is your workload configuration's specified service `name`.
<br>
For example:
<pre class="terminal">kubectl get svc nginx</pre>
1. Retrieve the load balancer's external IP address and port from the returned listing.
1. To access the app, run the following on the command:
```
curl http://EXTERNAL-IP:PORT
```
Where:
* `EXTERNAL-IP` is the IP address of the load balancer
* `PORT` is the port number.
<p class='note'><strong>Note</strong>: This command should be run on a server with network connectivity and visibility to the IP address of the worker node.</p>