• Stars
    star
    182
  • Rank 203,976 (Top 5 %)
  • Language
    C#
  • License
    MIT License
  • Created over 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Orleans Membership provider for Kubernetes

Orleans.Clustering.Kubernetes

Orleans Clustering Provider for Kubernetes

CI NuGet

Orleans is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.

Kubernetes (a.k.a. Kube or just K8s) is an open-source system for automating deployment, scaling, and management of containerized applications. In other words, it is one of the most popular container orchestrators out there.

Orleans.Clustering.Kubernetes is a package that use Kubernetes as a backend for Cluster Membership, making it easy to run Orleans clusters on top of Kubernetes.

TL;DR

If you want to quickly test it, clone this repo and go to the Samples Directory for instructions on how to run a sample cluster.

Overview

Kubernetes has multiple ways to extend its API and one of those ways allow you to easily add custom data structures to it so it can be consumed later on by applications. Those objects are called Custom Resources (CRD). The objects created based on CRDs are backed by the internal etcd instance part of every Kubernetes deployment.

Two CRDs are created by this provider in order to store the Cluster Membership objects to comply with Orleans Extended Cluster Membership Protocol. ClusterVersion and Silo. Examples on how to install each CRD can be found under the samples folder.

Those objects can be created at startup of the first silo in the cluster or, manually created by regular .yaml files. The package includes the two files with the required specs for each one. They must be deployed into the cluster before any Orleans application is deployed with this provider.

This provider uses only Kubernetes API Server to create/read those objects. By default, it uses the In Cluster API endpoint which is available on each pod.

From the security perspective, the provider uses whatever serviceaccount configured for the Kubernetes Deployment object by reading the API credentials from the pod itself.

Installation

Installation is performed via NuGet

From Package Manager:

PS> Install-Package Orleans.Clustering.Kubernetes

.Net CLI:

# dotnet add package Orleans.Clustering.Kubernetes

Paket:

# paket add Orleans.Clustering.Kubernetes

Configuration

A functional Kubernetes cluster is required for this provider to work. If you don't have one yet, there are multiple (and mostly complicated) ways to deploy Kubernetes for production use and it is out of scope of this provider as there are many articles around the web on how to do it. However, if you are playing with Docker and Kubernetes for the first time or you want to build a development box, Scott Hanselman has a nice article showing how to easily setup Docker for Windows with Kubernetes on your machine. Although it shows Windows 10, it can be easily adopted to Mac OSX as well.

Custom Resource Definitions

You need to apply both .yaml files from the package before starting the silo. It must be done once per Kubernetes cluster.

Note: You can also deploy the CRDs from the files on the Definitions directory on this repo.

Silo

Tell Orleans runtime that we are going to use Kubernetes as our Cluster Membership Provider:

var silo = new SiloBuilder()
        ...
        .UseKubeMembership()
        ...
        .Build();

Client

Now that our silo is up and running, the Orleans client needs to connect to the Kubernetes to look for Orleans Gateways.

var client = new ClientBuilder()
        ...
        .UseKubeGatewayListProvider() // Optionally use the configure delegate to specify the namespace where you cluster is running.
        ...
        .Build();

The provider will discover the cluster based on the kubernetes namespace the silo pod is running. In the case of the client, if a configure delegate with the Namespace property set to a non-null value is specified, it will ignore the current running pod namespace and will try to use that namespace instead.

Great! Now enjoy your Orleans application running within a Kubernetes cluster without needing an external membership provider!

Security considerations

This provider behaves like any regular application being hosted on Kubernetes. That means it doesn't care about the underlying kubernetes security model. In this particular provider however, it expects the pod to have access to the API server. Usually this access is granted to the service account being used by the POD (for more on that check Kubernetes docs for service accounts) by enabling RBAC or whatever other authorization plugin your cluster is using.

Regardless of the authorization plugin being used, ensure the following:

  1. The service account on the Silo pod has access to the Kubernetes API server to read and write objects (essentially GET, LIST, PUT, DELETE, POST permissions);
  2. The service account on the Client pod must be able to access the Kubernetes API server to read objects (GETand LIST permissions).

Contributions

PRs and feedback are very welcome! This repo follows the same contributions guideline as Orleans does and github issues will have help-wanted topics as they are coming.

More Repositories

1

OrleansDashboard

📊 A developer dashboard for Microsoft Orleans
C#
686
star
2

Orleankka

Functional API for Microsoft Orleans http://orleanscontrib.github.io/Orleankka
C#
486
star
3

SignalR.Orleans

SignalR backend based on Orleans.
C#
286
star
4

DesignPatterns

📐 Design patterns for Project Orleans
243
star
5

Orleans.Sagas

A distributed saga implementation for Orleans
C#
149
star
6

Awesome-Orleans

😎 Awesome Microsoft Orleans Projects
130
star
7

Orleans.Http

An HTTP API for Microsoft Orleans
C#
105
star
8

Orleans.Providers.MongoDB

A MongoDb implementation of the Orleans Providers: Membership, Storage and Reminders.
C#
98
star
9

Orleans.Activities

Workflow Foundation (.Net 4.x System.Activities workflows) over Microsoft Orleans framework, providing stable, long-running, extremely scalable processes with XAML designer support.
C#
83
star
10

meetups

📆 A repository to organise virtual meetups to discuss Orleans and other distributed systems programming on .NET
79
star
11

OrleansTestKit

Unit Test Toolkit for Microsoft Orleans
C#
74
star
12

Orleans.Redis

Redis support packages for Orleans
C#
68
star
13

OrleansFabricSilo

Orleans running on Service Fabric
C#
59
star
14

Orleans.SyncWork

This package's intention is to expose an abstract base class to allow https://github.com/dotnet/orleans/ to work with long running CPU bound synchronous work, without becoming overloaded.
C#
54
star
15

Orleans.Providers.EntityFramework

An Entity Framework Core implementation of Orleans Grain Storage. More providers to come later.
C#
50
star
16

Orleans.HttpGateway.AspNetCore

C#
49
star
17

Orleans.Indexing

C#
46
star
18

Orleans.StorageProvider.Redis

A Redis implementation of the Orleans Storage Provider model. Uses the Azure Redis Cache to persist grain states.
C#
42
star
19

Orleans.Consensus

Raft implemented on Orleans
C#
41
star
20

Orleans.CosmosDB

Orleans providers for Azure Cosmos DB
C#
40
star
21

OrleansTemplates

C#
37
star
22

Announcements

📢 Orleans related public announcements - watch this repo to stay up-to-date
36
star
23

Orleans.Providers.RabbitMQ

Orleans providers for RabbitMQ.
C#
32
star
24

Orleans.MultiClient

A library to simplify access to multiple Orleans Clusters from a single point.
C#
30
star
25

Orleans.EventSourcing.Snapshot

Snapshot storage provider for orleans event sourcing
C#
30
star
26

OrleansMonitor

Use this library to monitor the Silos in your Orleans Deployment
C#
29
star
27

Orleans.Indexing-1.5

C#
27
star
28

Orleans.Containers

Distributed storage and processing of objects in Orleans
C#
26
star
29

orleans.eventsourcing

Event Sourcing support for Microsoft Orleans
C#
20
star
30

OrleansBlobStorageProvider

DEPRECATED - now part of the orleans codebase :shipit:
C#
13
star
31

Orleans.StorageProviders.SimpleSQLServerStorage

Ultra low friction Orleans Storage Provider using SQLServer
C#
13
star
32

OrleansShardedStorage

A library and test application to shard Orleans grains across multiple Azure Storage Accounts
C#
12
star
33

Orleans.Extensibility.IdentityServer

Makes Orleans the backend storage for IdentityServer4
C#
11
star
34

orleans.storageprovider.ravendb

Orleans StorageProvider for RavenDB
C#
11
star
35

orleans-samples

Sample projects
C#
10
star
36

Orleans.TelemetryConsumers.ElasticSearch

Telemetry Consumers posting to ElasticSearch
C#
10
star
37

OrleansCassandraUtils

MSR Orleans integration with Cassandra with grain persistence, clustering and reminder table support
C#
10
star
38

Orleans.Streams.Kafka

C#
8
star
39

Orleans.Telemetry.SerilogConsumer

Serilog ITelemetryConsumer and ILogConsumer implementations for Orleans.
C#
7
star
40

node-orleans

A node.js client for codename orleans
JavaScript
7
star
41

Orleans.IdentityStore

Use Orleans as an identity store for ASP Core
C#
7
star
42

Orleans.Dashboard

A Microsoft Orleans Dashboard application based on Blazor
CSS
6
star
43

OrleansCouchbaseProvider

C#
6
star
44

Orleans.TelemetryConsumers.MetricsTracker

The purpose of MetricsTracker isn't to visualize data directly, but to provide a simple, stable, performant, and effective streaming data source to feed a growing collection of useful Orleans monitoring, diagnostics & visualization tools.
JavaScript
6
star
45

Orleans.Persistence.Minio

Minio implementation of Orleans Grain Storage Provider
C#
5
star
46

Orleans.StorageProvider.Arango

🥑 ArangoDB Storage Provider for Microsoft Orleans
C#
4
star
47

orleans.storageprovider.documentdb

DocumentDB storage provider for Orleans
C#
4
star
48

Orleans.Clustering.Cassandra

A Cassandra implementation of the Orleans Membership Provider
C#
4
star
49

orleans.serialization.json

Json serialization related libraries for Orleans.
C#
3
star
50

Orleans.TelemetryConsumers.Datadog

Orleans integration package for Datadog.
C#
3
star
51

Orleans.Persistence.Cassandra

A Cassandra implementation of the Orleans Storage Provider
C#
3
star
52

presentations

📃 A repository of presentations and other marketing material for Microsoft Orleans
3
star
53

WebHostCompatibilityLayer

C#
2
star
54

Orleans.Providers.Firebase

Orleans providers for Firebase realtime database.
C#
2
star
55

Orleans.AspNetCore.SignalR

SignalR backplane based on Microsoft Orleans for ASP.NET Core
2
star
56

OrleansStatsDUtils

Orleans statistics provider for StatsD
C#
2
star
57

orleans.storageprovider.cloudservicewrapper

Azure Cloud Service Wrapper class for Orleans Storage Providers to enable configuration of settings using the Azure service configuration file
C#
1
star