|
10 | 10 | ## Introduction
|
11 | 11 | AWS Cloud Map multi-cluster service discovery for Kubernetes (K8s) is a controller that implements existing multi-cluster services API that allows services to communicate across multiple clusters. The implementation relies on [AWS Cloud Map](https://aws.amazon.com/cloud-map/) for enabling cross-cluster service discovery.
|
12 | 12 |
|
| 13 | +## Usage |
| 14 | +> ⚠ **There must exist network connectivity (i.e. VPC peering, security group rules, ACLs, etc.) between clusters**: Undefined behavior may occur if controller is set up without network connectivity between clusters. |
| 15 | +
|
| 16 | +### Setup clusters |
| 17 | + |
| 18 | +First, install the controller with latest release on at least 2 AWS EKS clusters. Nodes must have sufficient IAM permissions to perform CloudMap operations. |
| 19 | + |
| 20 | +```sh |
| 21 | +kubectl apply -k "github.com/aws/aws-cloud-map-mcs-controller-for-k8s/config/controller_install_release" |
| 22 | +``` |
| 23 | + |
| 24 | +> 📌 See [Releases](#Releases) section for details on how to install other versions. |
| 25 | +
|
| 26 | +### Export services |
| 27 | + |
| 28 | +Then assuming you already have a Service installed, apply a `ServiceExport` yaml to the cluster in which you want to export a service. This can be done for each service you want to export. |
| 29 | + |
| 30 | +```yaml |
| 31 | +kind: ServiceExport |
| 32 | +apiVersion: multicluster.x-k8s.io/v1alpha1 |
| 33 | +metadata: |
| 34 | + namespace: [Your service namespace here] |
| 35 | + name: [Your service name] |
| 36 | +``` |
| 37 | +
|
| 38 | +**Example:** This will export a service with name *my-amazing-service* in namespace *hello* |
| 39 | +```yaml |
| 40 | +kind: ServiceExport |
| 41 | +apiVersion: multicluster.x-k8s.io/v1alpha1 |
| 42 | +metadata: |
| 43 | + namespace: hello |
| 44 | + name: my-amazing-service |
| 45 | +``` |
| 46 | +
|
| 47 | +*See the `samples` directory for a set of example yaml files to set up a service and export it. To apply the sample files run* |
| 48 | +```sh |
| 49 | +kubectl create namespace demo |
| 50 | +kubectl apply -f https://raw.githubusercontent.com/aws/aws-cloud-map-mcs-controller-for-k8s/main/samples/demo-deployment.yaml |
| 51 | +kubectl apply -f https://raw.githubusercontent.com/aws/aws-cloud-map-mcs-controller-for-k8s/main/samples/demo-service.yaml |
| 52 | +kubectl apply -f https://raw.githubusercontent.com/aws/aws-cloud-map-mcs-controller-for-k8s/main/samples/demo-export.yaml |
| 53 | +``` |
| 54 | + |
| 55 | +### Import services |
| 56 | + |
| 57 | +In your other cluster, the controller will automatically sync services registered in AWS CloudMap by applying the appropriate `ServiceImport`. To list them all, run |
| 58 | +```sh |
| 59 | +kubectl get ServiceImport -A |
| 60 | +``` |
| 61 | + |
13 | 62 | ## Releases
|
14 | 63 |
|
15 | 64 | AWS Cloud Map MCS Controller for K8s adheres to the [SemVer](https://semver.org/) specification. Each release updates the major version tag (eg. `vX`), a major/minor version tag (eg. `vX.Y`) and a major/minor/patch version tag (eg. `vX.Y.Z`). To see a full list of all releases, refer to our [Github releases page](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/releases).
|
16 | 65 |
|
| 66 | +To install from a release run |
| 67 | +```sh |
| 68 | +kubectl apply -k "github.com/aws/aws-cloud-map-mcs-controller-for-k8s/config/controller_install_release[?ref=*git version tag*]" |
| 69 | +``` |
| 70 | + |
| 71 | +Example to install latest release |
| 72 | +```sh |
| 73 | +kubectl apply -k "github.com/aws/aws-cloud-map-mcs-controller-for-k8s/config/controller_install_release" |
| 74 | +``` |
| 75 | + |
| 76 | +Example to install v0.1.0 |
| 77 | +```sh |
| 78 | +kubectl apply -k "github.com/aws/aws-cloud-map-mcs-controller-for-k8s/config/controller_install_release?ref=v0.1.0" |
| 79 | +``` |
| 80 | + |
17 | 81 | We also maintain a `latest` tag, which is updated to stay in line with the `main` branch. We **do not** recommend installing this on any production cluster, as any new major versions updated on the `main` branch will introduce breaking changes.
|
18 | 82 |
|
19 | 83 | To install from `latest` tag run
|
20 | 84 | ```sh
|
21 |
| -kubectl apply -k github.com/aws/aws-cloud-map-mcs-controller-for-k8s/config/controller_install_latest |
| 85 | +kubectl apply -k "github.com/aws/aws-cloud-map-mcs-controller-for-k8s/config/controller_install_latest" |
22 | 86 | ```
|
23 | 87 |
|
24 | 88 | ## Contributing
|
|
0 commit comments