Setup Ingress for a Project
This doc will walk through how to setup ingress for your Project using the Kubernetes API.
Setup Ingress to the CloudFlow Edge for HTTP workload
To setup ingress you will:
- Create the necessary Kubernetes Service object to expose the web server to the Internet.
- Use your DNS provider to direct traffic to your web server with a CNAME record.
Create a Service object
Create a yaml file, such as my-service.yaml
my-service.yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: ingress-upstream
name: ingress-upstream
spec:
ports:
- name: 80-8080
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
sessionAffinity: None
type: ClusterIP
Use kubectl to create your ingress service
Deploy your service
kubectl apply -f my-service.yaml
The Service called ingress-upstream
causes the deployment of special ingress pods into your environment that route traffic into your app. Read more about the CloudFlow HTTP Ingress.
See your service running on CloudFlow
kubectl get services
You will see a new ingress-upstream
service, as in the following example.
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.xx.xx.xx <none> 443/TCP 6m55s
ingress-upstream ClusterIP 10.xx.xx.xx <none> 80/TCP 1s
See the pods running on CloudFlow's network
kubectl get pods -o wide
Note that you didn't set a location optization strategy, so CloudFlow will run your application with the default (2 locations).
Setup DNS
- On the overview page of the CloudFlow Console, find and click your environment.
- Under Settings select Domains.
- Confirm that the domain name you provided when you created the environment is listed.
- Visit your DNS provider and create a CNAME record to point to CloudFlow as instructed on the CloudFlow Console Domains page.
- After some time you will be able to click the Verify button to confirm that DNS is engaged.
Congratulations!
When you visit your hostname in a web browser, you'll see "Welcome to nginx!". This tells you that you application is successfully deployed!