KOP Recipes - Ambassador - Rafay Product Documentation

Ambassador

Ambassador Edge Stack is an API gateway that serves as an ingress controller into your Kubernetes cluster. Ambassador Edge Stack offers a comprehensive set of security functionality, supports a broad range of protocols, and supports progressive releases with modern traffic management. To learn more about Ambassador Edge Stack, you can read more about it here.

What Will You Do

In this exercise,

Assumptions

Step 1: Add Repository To Integrations

Step 2: Customize Helm Install (optional)

Go to the Helm Chart Readme for all available Helm values. Create a values.yaml to customize your helm release, such as setting pod annotations or changing port values.

Step 3: Create Namespaces

Step 4: Create Addon

Step 5: Create Blueprint

Step 6: Apply Blueprint

Step 7: Verify Deployment (optional)

kubectl get pod -n ambassador
NAME                                READY   STATUS    RESTARTS   AGE
ambassador-agent-69979f6598-5qrk4   1/1     Running   0          3m34s
ambassador-b6fd977c7-zk5lz          1/1     Running   0          3m34s
ambassador-redis-59f894b97f-fm4zc   1/1     Running   0          3m34s

Step 8: Create Workload

kubectl -n ambassador get svc ambassador -o "go-template={{range .status.loadBalancer.ingress}}{{or .ip .hostname}}{{end}}"

I Don't Have A Domain Name (optional)

Nip.io is a dynamic, wildcard DNS server that translates a hostname with an embedded IP address into that IP address itself.

Use the IP address obtained previously and construct a nip.io hostname. For example, if you have an IP address of 169.254.169.254, you can use 169.254.169.254.nip.io as your hostname.

---
apiVersion: getambassador.io/v2
kind: Host
metadata:
  name: quote-host
spec:
  hostname: quote.example.com # Replace with your hostname from step above.
  acmeProvider:
    authority: https://acme-v02.api.letsencrypt.org/directory
    email: my-email@datawire.io # Replace with your email
  tlsSecret:
    name: quote.example.com # Replace with your hostname from step above.
---
apiVersion: getambassador.io/v2
kind: Mapping
metadata:
  name: quote-backend
spec:
  prefix: /backend/
  service: quote
---
apiVersion: v1
kind: Service
metadata:
  name: quote
spec:
  ports:
  - name: http
    port: 80
    targetPort: 8000
  - name: https
    port: 443
    targetPort: 8000
  selector:
    app: quote
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: quote
spec:
  replicas: 1
  selector:
    matchLabels:
      app: quote
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: quote
    spec:
      containers:
      - name: backend
        image: docker.io/datawire/quote:0.4.1
        ports:
        - name: http
          containerPort: 8000
        env:
        - name: PORT
          value: "8000"
        resources:
          limits:
            cpu: "0.1"
            memory: 100Mi

Step 9: Verify Workload

    NAME                         READY   STATUS    RESTARTS   AGE
    pod/quote-74bd568645-dv4mw   1/1     Running   0          34m

NAME            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
    service/quote   ClusterIP   10.100.151.122   <none>        80/TCP,443/TCP   34m

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/quote   1/1     1            1           34m

NAME                               DESIRED   CURRENT   READY   AGE
    replicaset.apps/quote-74bd568645   1         1         1       34m
    ```

## Step 10: Access Your Cluster From An External Source

Open a terminal session on your computer. Run the following command to see if you can access the quote service from your machine:

curl -k https://{HOST_NAME_FROM_STEP_8}/backend/ #Replace the "{HOST_NAME_FROM_STEP_8}" with the host name received from step 8.


You should get an output similar to the following:

{ "server": "gargantuan-raspberry-3x2rdgd8", "quote": "A late night does not make any sense.", "..." }


## Recap

Congratulations! You have successfully created a custom cluster blueprint with the "Ambassador Edge Stack" addon and applied it to a cluster. You can now use this blueprint on as many clusters as you require.