Skip to content

Commit 6d06f3f

Browse files
committed
Add README for k8s multi cluster
Signed-off-by: Yoshiki Fujikane <[email protected]>
1 parent 6d9c411 commit 6d06f3f

File tree

9 files changed

+191
-77
lines changed

9 files changed

+191
-77
lines changed

cmd/pipedv1/README.md

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Kubernetes Multicluster Plugin
2+
3+
## Specification
4+
5+
The current specification is described in the [RFC](../../../../../docs/rfcs/0014-multi-cluster-deployment-for-k8s.md).
6+
The configuration format is unstable and may change in the future.
7+
8+
## Try k8s multicluster plugin locally
9+
10+
**Prepare the PipeCD Control Plane**
11+
12+
Please refer to [pipe-cd/pipecd/cmd/pipecd/README.md](../../../../../cmd/pipecd/README.md) to set up the Control Plane in your local environment.
13+
14+
- Prepare two k8s clusters
15+
16+
```
17+
kind create cluster --name cluster1
18+
kind export kubeconfig --name cluster1 --kubeconfig /path/to/kubeconfig/for/cluster1
19+
20+
kind create cluster --name cluster2
21+
kind export kubeconfig --name cluster2 --kubeconfig /path/to/kubeconfig/for/cluster2
22+
```
23+
24+
**Start pipedv1 locally**
25+
26+
Please refer to [pipe-cd/pipecd/cmd/pipedv1/README.md](../../../../../cmd/pipedv1/README.md) to set up the Control Plane in your local environment.
27+
At this time, please modify the `spec.plugins` section of the piped config as shown below.
28+
29+
```yaml
30+
...
31+
plugins:
32+
- name: kubernetes_multicluster
33+
port: 7002
34+
url: file:///path/to/.piped/plugins/kubernetes_multicluster # It's OK using any value for now because it's a dummy. We will implement it later.
35+
deployTargets:
36+
- name: cluster1
37+
config:
38+
masterURL: https://127.0.0.1:61337 # shown by kubectl cluster-info
39+
kubeConfigPath: /path/to/kubeconfig/for/cluster1
40+
- name: cluster2
41+
config:
42+
masterURL: https://127.0.0.1:62082 # shown by kubectl cluster-info
43+
kubeConfigPath: /path/to/kubeconfig/for/cluster2
44+
```
45+
46+
**Prepare the manifest**
47+
48+
- Please create a new repository for the manifest.
49+
If there is an app.pipecd.yaml in the format before supporting the plugin mechanism, an error will occur.
50+
51+
- Copy the app you want to run from the Examples and commit it.
52+
53+
**Register the application**
54+
55+
![adding-application](./docs/static/adding-application.png)
56+
57+
At this time, please select multiple DeployTargets.
58+
59+
## Examples
60+
There are examples under `./example`.
61+
62+
| Name | Description |
63+
|------|-------------|
64+
| [simple](./example/simple/) | Deploy the same resources to the multiple clusters. |
65+
| [multi-sources-template-none](./example/multi-sources-template-none/) | Deploy the different resources to the multiple clusters. |
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: Application
3+
spec:
4+
name: multi-sources-template-none
5+
labels:
6+
env: example
7+
plugins:
8+
kubernetes_multicluster:
9+
quickSync:
10+
prune: true
11+
input:
12+
multiTargets:
13+
- target:
14+
name: cluster1
15+
manifests:
16+
- ./cluster1/deployment.yaml
17+
- target:
18+
name: cluster2
19+
manifests:
20+
- ./cluster2/deployment.yaml
21+
kubectlVersion: 1.32.2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: cluster1
5+
labels:
6+
app: cluster1
7+
spec:
8+
replicas: 2
9+
selector:
10+
matchLabels:
11+
app: cluster1
12+
pipecd.dev/variant: primary
13+
template:
14+
metadata:
15+
labels:
16+
app: cluster1
17+
pipecd.dev/variant: primary
18+
annotations:
19+
sidecar.istio.io/inject: "false"
20+
spec:
21+
containers:
22+
- name: helloworld
23+
image: ghcr.io/pipe-cd/helloworld:v0.32.0
24+
args:
25+
- server
26+
ports:
27+
- containerPort: 9085
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: cluster2
5+
labels:
6+
app: cluster2
7+
spec:
8+
replicas: 2
9+
selector:
10+
matchLabels:
11+
app: cluster2
12+
pipecd.dev/variant: primary
13+
template:
14+
metadata:
15+
labels:
16+
app: cluster2
17+
pipecd.dev/variant: primary
18+
annotations:
19+
sidecar.istio.io/inject: "false"
20+
spec:
21+
containers:
22+
- name: helloworld
23+
image: ghcr.io/pipe-cd/helloworld:v0.32.0
24+
args:
25+
- server
26+
ports:
27+
- containerPort: 9085
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: Application
3+
spec:
4+
name: simple
5+
labels:
6+
env: example
7+
plugins:
8+
kubernetes_multicluster:
9+
input:
10+
manifests:
11+
- deployment.yaml
12+
- service.yaml
13+
kubectlVersion: 1.32.2
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: simple
5+
labels:
6+
app: simple
7+
spec:
8+
replicas: 2
9+
selector:
10+
matchLabels:
11+
app: simple
12+
pipecd.dev/variant: primary
13+
template:
14+
metadata:
15+
labels:
16+
app: simple
17+
pipecd.dev/variant: primary
18+
annotations:
19+
sidecar.istio.io/inject: "false"
20+
spec:
21+
containers:
22+
- name: helloworld
23+
image: ghcr.io/pipe-cd/helloworld:v0.32.0
24+
args:
25+
- server
26+
ports:
27+
- containerPort: 9085
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: simple
5+
spec:
6+
selector:
7+
app: simple
8+
ports:
9+
- protocol: TCP
10+
port: 9085
11+
targetPort: 9085

0 commit comments

Comments
 (0)