Deploying EventStore to Azure Kubernetes

Prerequisites

I used this link as a guide to install the tools required for deploying EventStore to Azure.

A description of the tools needed are as follows:

  • Kubectl: Kubernetes command-line tool
  • Helm: Kubernetes package manager
  • Azure CLI: Azure command-line tool

EventStore Deployed on Azure

I observed the following resources created in Azure after executing the commands listed from the  link:

ResourceGroups0

Connecting to the EventStore hosted on Azure

I wrote the following test to establish a connection to the EventStore running in Azure:

[Test]
let ``Azure: Establish connection to event store``() =

    // Setup
    let credentials    = UserCredentials("admin", "changeit");
    let port           = 1113
    let clusterAddress = "45.68.231.227" // 

    // Test
    use connection= EventStore.remoteConnection clusterAddress port credentials

    // Verify
    Assert.NotNull connection

Retrieving the IP Address

I extracted the IP address by navigating to the root resource and then selecting the Kubernetes service:

ResourceGroups

From the Kubernetes service, I referenced the API server address:

ResourceGroups3

I then mapped the API server address to its corresponding IP address as depicted in the test code.

Implementation:

Here’s the implementation details for establishing the remote endpoint connection:

    let remoteConnection (ipAddress:string) (port:int) (credentials:UserCredentials) =

        let connectionSettings = ConnectionSettings.Create()
                                                   .SetDefaultUserCredentials(credentials)
                                                   .Build()

        let connection = EventStoreConnection.Create(connectionSettings, new IPEndPoint(IPAddress.Parse(ipAddress), port))

        connection.ConnectAsync().Wait()
        connection

Conclusion

In conclusion, I documented the tools as well as the code required to deploy an event-store to Azure. I also documented how to retrieve the API server address that’s required, before mapping it to an IP address. Lastly, I showed the implementation details on how to pass-in user credentials and the IP address to establish a connection.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s