KuthumiPepple commented on code in PR #68: URL: https://github.com/apache/camel-k-examples/pull/68#discussion_r967980995
########## generic-examples/master/README.md: ########## @@ -1,3 +1,71 @@ -# Master Camel K examples +# Using Master in Camel K example -Find useful examples about how to use Master in a Camel K integration. \ No newline at end of file +This example shows how to start a route only on a single instance of a Camel K integration. This is done using the `Master` component. + +You can find more information about Apache Camel and Apache Camel K on the [official Camel website](https://camel.apache.org). + +## Before you begin + +Read the general instructions in the [root README.md file](/README.md) for setting up your environment and the Kubernetes cluster before looking at this example. + +Make sure you've read the [installation instructions](https://camel.apache.org/camel-k/latest/installation/installation.html) for your specific +cluster before starting the example. + +## Understanding the Example +- [Master.java](./Master.java): defines a route that will be started only on a single instance/pod. This is defined by prefixing the camel endpoint with `master:someName`. +Under the hood, the pod replicas take part in a leader election where each pod races to become the leader. The pod that emerges as leader will be the only instance that is active and consumes from the specified camel endpoint. If the leader fails, another pod becomes the new leader, thus becoming the only instance that consumes from the camel endpoint. + +## Running the example +**Note**: it is recommended to use a different service account other than "default" when running the integration because special permissions are added to the integration service account in order to read/write configmaps and read pods. + +Run the integration: +``` +kamel run Master.java +``` +In this example, we will use the `stern` CLI tool to view the logs because it allows us to view multiple pod logs at the same time. <br> Review Comment: Will do -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org