Skip to content

Commit

Permalink
Merge pull request #38 from yasassri/develop
Browse files Browse the repository at this point in the history
Fix links
  • Loading branch information
yasassri authored May 19, 2024
2 parents 1924e34 + b5f41b2 commit 9ac1642
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ Caused by: org.wso2.carbon.membership.scheme.kubernetes.exceptions.KubernetesMem

The thought process was that it had been working fine for three years and suddenly broke, so obviously, the Ops team must have made some changes to the K8S cluster, right? :) After checking with them, it turned out they hadn't made any changes recently. So, we had to find out what was going on. Let's look at the exception closely: it's thrown from the clustering component of WSO2. When you want tasks to be coordinated in a multinode WSO2 application setup, you can enable clustering in WSO2. For clustering to work, WSO2 should be able to discover the application nodes and communicate with each other. WSO2 clustering uses Hazelcast underneath with a custom membership schema (this is where you tell Hazelcast how to discover other members of the cluster).

So, let's put on the developer hat. According to the stack trace, the exception is thrown from the `org.wso2.carbon.membership.scheme.kubernetes.KubernetesMembershipScheme` class. Since WSO2 is an open-source product, we can look into the code and see what exactly is happening. I won't go into details, but basically, WSO2 is calling K8S APIs to retrieve member details. If anyone is interested, here is where the exception is thrown: https://github.com/wso2/kubernetes-common/blob/v1.0.4/kubernetes-membership-scheme/src/main/java/org/wso2/carbon/membership/scheme/kubernetes/KubernetesMembershipScheme.java#L97.
So, let's put on the developer hat. According to the stack trace, the exception is thrown from the `org.wso2.carbon.membership.scheme.kubernetes.KubernetesMembershipScheme` class. Since WSO2 is an open-source product, we can look into the code and see what exactly is happening. I won't go into details, but basically, WSO2 is calling K8S APIs to retrieve member details. If anyone is interested, here is where the exception is thrown: [Membership Schema Source](https://github.com/wso2/kubernetes-common/blob/v1.0.4/kubernetes-membership-scheme/src/main/java/org/wso2/carbon/membership/scheme/kubernetes/KubernetesMembershipScheme.java#L97).

Let's see how clustering works in WSO2, so we can better understand the issue. Basically, a pod is exposed via a K8S service. When a service is created, K8S will create endpoints to represent each pod, which are grouped based on the selectors. So, in order to identify the members and their IPs, WSO2 calls the Endpoints API in K8S (https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoints-v1/#http-request), which returns a list of endpoints registered and their states. The response will be something like below.
Let's see how clustering works in WSO2, so we can better understand the issue. Basically, a pod is exposed via a K8S service. When a service is created, K8S will create endpoints to represent each pod, which are grouped based on the selectors. So, in order to identify the members and their IPs, WSO2 calls the [Endpoints API](https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoints-v1/#http-request) in K8S , which returns a list of endpoints registered and their states. The response will be something like below.

```
Name: "mysvc",
Expand Down

0 comments on commit 9ac1642

Please sign in to comment.