Archived
Create a LoadBalancer for nginx.
This commit is contained in:
1 parent
0179bb0828
commit
f5b4a7d323
4 files changed
+56
-3
No files matched your search
@@ -126,6 +126,8 @@ nginx NodePort 172.20.10.182 <none> 80:31234/TCP 6m8s app=Nginx
|
||||
|
||||
### Reaching the app.
|
||||
|
||||
#### Using the NodePort
|
||||
|
||||
It is not possible with terraform output to retrieve the configured nodes. However, it is possible to retrieve IPs for our nodes using aws cli:
|
||||
|
||||
```sh
|
||||
@@ -146,6 +148,31 @@ $ curl http://$CLUSTER_IP:31234/
|
||||
```
|
||||
|
||||
|
||||
#### Using the LoadBalancer
|
||||
|
||||
This approach is simpler, as it is just needed to retrieve the created the LoadBalancer external address, either by using `kubectl` or `terraform output`:
|
||||
|
||||
```sh
|
||||
$ kubectl get svc -n testaroo nginx-lb
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
nginx-lb LoadBalancer 172.20.149.132 a34059e68106b41a292730b5defe734b-581837320.eu-west-3.elb.amazonaws.com 80:31698/TCP 3m50s
|
||||
|
||||
$ terraform output 09:59:47
|
||||
lb-address = "a34059e68106b41a292730b5defe734b-581837320.eu-west-3.elb.amazonaws.com"
|
||||
```
|
||||
|
||||
The service should be reachable directly using it:
|
||||
|
||||
```sh
|
||||
$ curl http://$(terraform output -raw lb-address):80/
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome to nginx!</title>
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
### Reaching the/a node ssh port:
|
||||
|
||||
Still using the AWS CLI to retrieve nodes, just:
|
||||
@@ -182,7 +209,7 @@ PID USER TIME COMMAND
|
||||
$ kubectl exec -ti -n testaroo alpine -- sh
|
||||
/ # echo "hello world"
|
||||
hello world
|
||||
/ #
|
||||
/ #
|
||||
```
|
||||
|
||||
## Todo:
|
||||
|
||||
Reference in new issue
Block a user