In this lab we are going to deploy multiple services from different teams and expose them using a shared domain, but each on their own path. We will use on-the-fly Knative services for speed and simplicity.
- You are familiar with Knative. Did you try following the Knative workshop?
- Knative is enabled in Otomi. (Check the
Apps
section underPlatform
.) - Two teams are created. We will refer to them as
alpha
andbeta
. (It is not necessary toDeploy
first.)
-
Select team
alpha
in the top bar, selectServices
from theTeam alpha
menu section and click onCreate Service
, and chooseNew knative service
. -
Provide the following values and
submit
:
- name:
sir
- Run As User:
1001
- Repository:
otomi/nodejs-helloworld
- Tag:
v1.2.12
- Limits:
CPU=100m
,Memory=128Mi
- Requests:
CPU=50m
,Memory=64Mi
- env:
TARGET=world, I just woke up!
,SERVANTS=servant-1,servant-2
- Check
Scale to zero
- Exposure:
Ingress
- Uncheck
Use team domain
- host:
hello-multi
(DNS zone can be left as-is)
Click Deploy
to start the service and domain registration, as that might take time. Plus we want the service to go to sleep as we intend to wake it up later (it serves a purpose, hope you spot it later on ;).
- Under the same team create the last
New knative service
service with the same values but the following diff andsubmit
:
- name:
informant
- Exposure:
Cluster
- Leave
Scale to zero
unchecked
- Under the same team create another
New knative service
service with the same values but with the following diff andsubmit
:
- name:
servant-1
- paths:
/servant-1
- env:
TARGET=sir
- Select team
beta
and create aNew knative service
service with the same values but the following diff andsubmit
:
- name:
servant-2
- paths:
/servant-2
- env:
TARGET=sir
,INFORMANT=http://informant.team-alpha
- Now click
Deploy Changes
again and watch the deployment finish in Drone.
In effect what we have done is create the following workloads for team alpha
:
master.team-alpha
exposed viahttps://hello-multi.$domain
servant-1.team-alpha
exposed viahttps://hello-multi.$domain/servant-1
informant.team-alpha
not exposed publicly, but only able to receive requests fromservant-2.team-beta
.
And for team beta
:
servant-2.team-beta
exposed viahttps://hello-multi.$domain/servant-2
Bonus: Add network policies to make sure no unforeseen traffic is routed :)
Go to the next lab.