This example creates a deployment named echoheaders on your cluster, which will run a single replica of the echoserver container, listening on port 8080 (http) and 8443 (https). Then create a Service that exposes our new application to the Internet over an Outscale Load Balancer Unit on http and https using certificates.
- Create ns
$ kubectl create namespace advanced-lb
namespace/advanced-lb created
- Create bucket for logs
$ aws s3 mb s3://ccm-examples --endpoint https://osu.eu-west-2.outscale.com
make_bucket: ccm-examples
- Deploy the pods to get the certificate
$ kubectl apply -f examples/advanced-lb/specs/deploy.yaml
deployment.apps/echoheaders created
- Get certificate generated by the pod by deploying the application , which a simple server that responds with the http headers it received, along with the Loadbalancer
$ kubectl get pods -n advanced-lb
NAME READY STATUS RESTARTS AGE
echoheaders-5465f4df9d-sw487 1/1 Running 0 2d23h
$ kubectl exec -n advanced-lb echoheaders-5465f4df9d-sw487 ls /certs
certificate.crt
privateKey.key
mkdir -p certs ; kubectl cp advanced-lb/echoheaders-5465f4df9d-sw487:/certs ./certs/
-
Upload 'UploadServerCertificate' the certs copied previously under ./certs and retrieve it ORN id
-
Update service yaml by setting the certificate ssl ORN ID and the loadBalancerSourceRanges and then apply it
$ OSC_ORN_ID="The ID" ; \
sed -i "s@OSC_ORN_ID@\"${OSC_ORN_ID}\"@g" ./examples/simple-lb/specs/svc.yaml
$ MY_CIDR=`curl ifconfig.io`"/32" ; \
sed -i "s@MY_CIDR@\"${MY_CIDR}\"@g" ./examples/simple-lb/specs/svc.yaml
$ kubectl apply -f examples/advanced-lb/specs/svc.yaml
service/echoheaders-lb-advanced-public created
$ kubectl get svc -n advanced-lb
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
echoheaders-lb-advanced-public LoadBalancer 10.32.29.197 ad51051c7a133489591adc0e1fbec049-832076221.eu-west-2.lbu.outscale.com 80:31174/TCP,443:31249/TCP 84m
- Wait for the lb to be ready and then check it is running and forwarding traffic
$ curl -k https://ad51051c7a133489591adc0e1fbec049-832076221.eu-west-2.lbu.outscale.com/
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.13.3</center>
</body>
</html>
notice: !!! You need to fix certificate name to match the outscale.com domain
- Cleanup resources:
$ kubectl delete -f examples/advanced-lb/specs/