-
Notifications
You must be signed in to change notification settings - Fork 4
/
skewer.yaml
130 lines (116 loc) · 4.86 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
title: Trade Zoo
subtitle: |
A simple trading application that runs in the public cloud but keeps its data in a private Kafka cluster
overview: |
This example is a simple Kafka application that shows how you can
use Skupper to access a Kafka cluster at a remote site without
exposing it to the public internet.
It contains four services:
* A Kafka cluster running in a private data center. The cluster has
two topics, "orders" and "updates".
* An order processor running in the public cloud. It consumes from
"orders", matching buy and sell offers to make trades. It
publishes new and updated orders and trades to "updates".
* A market data service running in the public cloud. It looks at
the completed trades and computes the latest and average prices,
which it then publishes to "updates".
* A web frontend service running in the public cloud. It submits
buy and sell orders to "orders" and consumes from "updates" in
order to show what's happening.
To set up the Kafka cluster, this example uses the Kubernetes
operator from the [Strimzi][strimzi] project. The other services
are small Python programs.
The example uses two Kubernetes namespaces, "private" and "public",
to represent the private data center and public cloud.
[strimzi]: https://strimzi.io/
sites:
public:
title: Public
platform: kubernetes
namespace: public
env:
KUBECONFIG: ~/.kube/config-public
private:
title: Private
platform: kubernetes
namespace: private
env:
KUBECONFIG: ~/.kube/config-private
steps:
- standard: install_the_skupper_command_line_tool
- standard: kubernetes/set_up_your_namespaces
- title: Deploy the Kafka cluster
preamble: |
In Private, use the `kubectl create` and `kubectl apply`
commands with the listed YAML files to install the operator and
deploy the cluster and topic.
commands:
private:
- run: kubectl create -f kafka-cluster/strimzi.yaml
- run: kubectl apply -f kafka-cluster/cluster1.yaml
- await_resource: kafka/cluster1
- run: kubectl wait --for condition=ready --timeout 900s kafka/cluster1
postamble: |
**Note:**
By default, the Kafka bootstrap server returns broker addresses
that include the Kubernetes namespace in their domain name.
When, as in this example, the Kafka client is running in a
namespace with a different name from that of the Kafka cluster,
this prevents the client from resolving the Kafka brokers.
To make the Kafka brokers reachable, set the `advertisedHost`
property of each broker to a domain name that the Kafka client
can resolve at the remote site. In this example, this is
achieved with the following listener configuration:
~~~ yaml
spec:
kafka:
listeners:
- name: plain
port: 9092
type: internal
tls: false
configuration:
brokers:
- broker: 0
advertisedHost: cluster1-kafka-0.cluster1-kafka-brokers
~~~
See [Advertised addresses for brokers][advertised-addresses] for
more information.
[advertised-addresses]: https://strimzi.io/docs/operators/in-development/configuring.html#property-listener-config-broker-reference
- title: Deploy the application services
preamble: |
In Public, use the `kubectl apply` command with the listed YAML
files to install the application services.
commands:
public:
- run: kubectl apply -f order-processor/kubernetes.yaml
- run: kubectl apply -f market-data/kubernetes.yaml
- run: kubectl apply -f frontend/kubernetes.yaml
- standard: kubernetes/create_your_sites
- standard: kubernetes/link_your_sites
- title: Expose the Kafka cluster
preamble: |
In Private, use `skupper expose` with the `--headless` option to
expose the Kafka cluster as a headless service on the Skupper
network.
Then, in Public, use `kubectl get service` to check that the
`cluster1-kafka-brokers` service appears after a moment.
commands:
private:
- await_resource: statefulset/cluster1-kafka
- run: skupper expose statefulset/cluster1-kafka --headless --port 9092
public:
- await_resource: service/cluster1-kafka-brokers
- run: kubectl get service/cluster1-kafka-brokers
- standard: hello_world/access_the_frontend
- standard: cleaning_up
commands:
private:
- run: skupper delete
- run: kubectl delete -f kafka-cluster/cluster1.yaml
- run: kubectl delete -f kafka-cluster/strimzi.yaml
public:
- run: skupper delete
- run: kubectl delete -f frontend/kubernetes.yaml
- run: kubectl delete -f market-data/kubernetes.yaml
- run: kubectl delete -f order-processor/kubernetes.yaml