forked from skupperproject/skewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskewer.yaml
113 lines (103 loc) · 4.29 KB
/
skewer.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
title: Skupper Hello World
subtitle: A minimal HTTP application deployed across Kubernetes clusters using Skupper
github_actions_url: https://github.com/skupperproject/skewer/actions/workflows/main.yaml
overview: |
This example is a very simple multi-service HTTP application that can
be deployed across multiple Kubernetes clusters using Skupper.
It contains two services:
* A backend service that exposes an `/api/hello` endpoint. It
returns greetings of the form `Hi, <your-name>. I am <my-name>
(<pod-name>)`.
* A frontend service that sends greetings to the backend and
fetches new greetings in response.
With Skupper, you can place the backend in one cluster and the
frontend in another and maintain connectivity between the two
services without exposing the backend to the public internet.
<img src="images/entities.svg" width="640"/>
prerequisites: |
Custom prerequisites
sites:
west:
kubeconfig: ~/.kube/config-west
namespace: west
east:
kubeconfig: ~/.kube/config-east
namespace: east
steps:
- standard: install_the_skupper_command_line_tool
- standard: configure_separate_console_sessions
- standard: access_your_clusters
- standard: set_up_your_namespaces
- standard: install_skupper_in_your_namespaces
- standard: check_the_status_of_your_namespaces
- standard: link_your_namespaces
- title: Fail on demand
commands:
west:
- run: |
if [ -n "${SKEWER_FAIL}" ]; then expr 1 / 0; fi
- title: Deploy the frontend and backend services
preamble: |
Use `kubectl create deployment` to deploy the frontend service
in `west` and the backend service in `east`.
commands:
west:
- run: kubectl create deployment frontend --image quay.io/skupper/hello-world-frontend
output: deployment.apps/frontend created
east:
- run: kubectl create deployment backend --image quay.io/skupper/hello-world-backend --replicas 3
output: deployment.apps/backend created
- title: Expose the backend service
preamble: |
We now have two namespaces linked to form a Skupper network, but
no services are exposed on it. Skupper uses the `skupper
expose` command to select a service from one namespace for
exposure on all the linked namespaces.
Use `skupper expose` to expose the backend service to the
frontend service.
commands:
east:
- await: deployment/backend
- run: skupper expose deployment/backend --port 8080
output: deployment backend exposed as backend
- title: Expose the frontend service
preamble: |
We have established connectivity between the two namespaces and
made the backend in `east` available to the frontend in `west`.
Before we can test the application, we need external access to
the frontend.
Use `kubectl expose` with `--type LoadBalancer` to open network
access to the frontend service.
commands:
west:
- await: deployment/frontend
- run: kubectl expose deployment/frontend --port 8080 --type LoadBalancer
output: service/frontend exposed
- standard: test_the_application
- standard: accessing_the_web_console
- standard: cleaning_up
commands:
west:
- run: skupper delete
- run: kubectl delete service/frontend
- run: kubectl delete deployment/frontend
east:
- run: skupper delete
- run: kubectl delete deployment/backend
summary: |
This example locates the frontend and backend services in different
namespaces, on different clusters. Ordinarily, this means that they
have no way to communicate unless they are exposed to the public
internet.
Introducing Skupper into each namespace allows us to create a virtual
application network that can connect services in different clusters.
Any service exposed on the application network is represented as a
local service in all of the linked namespaces.
The backend service is located in `east`, but the frontend service
in `west` can "see" it as if it were local. When the frontend
sends a request to the backend, Skupper forwards the request to the
namespace where the backend is running and routes the response back to
the frontend.
<img src="images/sequence.svg" width="640"/>
next_steps: |
Custom next steps