-
-
Notifications
You must be signed in to change notification settings - Fork 13
Add guide for deploying operators and CSI drivers on separate nodes #818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7ec0f41
Add guide for deploying operators and CSI drivers on separate nodes
NickLarsenNZ 01da299
wip
NickLarsenNZ 5481429
wip
NickLarsenNZ 77c210f
Apply suggestions from code review
NickLarsenNZ 758b3c9
Make an antora extension to derive the operator branches
NickLarsenNZ 5a9742a
Update stackable helper to set the operator version too
NickLarsenNZ fb9badc
Apply suggestions from code review
NickLarsenNZ ba16b34
Add illustration
NickLarsenNZ da803e3
remove zookeeper znode for nifi
NickLarsenNZ c5fd24f
Apply suggestions from code review
NickLarsenNZ a6dd3ea
Merge branch 'main' into guide/csi-driver-nodeselector
NickLarsenNZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
353 changes: 353 additions & 0 deletions
353
modules/guides/pages/deploy-operators-and-csi-drivers-separately.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,353 @@ | ||
| = Deploying operators and CSI drivers on separate nodes | ||
| :related-issue: https://github.com/stackabletech/issues/issues/763 | ||
| :secret-operator-values: https://github.com/stackabletech/secret-operator/blob/main/deploy/helm/secret-operator/values.yaml | ||
| :listener-operator-values: https://github.com/stackabletech/listener-operator/blob/main/deploy/helm/listener-operator/values.yaml | ||
| :commons-operator-values: https://github.com/stackabletech/commons-operator/blob/main/deploy/helm/commons-operator/values.yaml | ||
| :nifi-operator-values: https://github.com/stackabletech/nifi-operator/blob/main/deploy/helm/nifi-operator/values.yaml | ||
| // TODO: Is there a way to make the links above go to the right place? | ||
| // Eg: we can search/replace "0.0.0-dev" with the release, but in the above case we would need to replace "main". | ||
|
|
||
| Operators can be installed on nodes separate from where the workloads will run. | ||
| There is a caveat when it comes to two operators: Secret Operator and Listener Operator. | ||
| They make use of the Container Storage Interface (CSI) and have components that must run on nodes with workloads that mount CSI volumes. | ||
|
|
||
| This guide will show how to schedule operators on one group of nodes (for example, a Karpenter NodePool), while scheduling applicable components where workload will run. | ||
|
|
||
| == Setup | ||
|
|
||
| You will need a Kubernetes cluster with multiple nodes split into two groups: | ||
|
|
||
| * stackable-operators | ||
| * stackable-workloads | ||
|
|
||
| // TODO: Add an image to illustrate what the guide aims to achieve | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| This guide will use _KinD_ to demonstrate, but if you are using Karpenter (eg: AWK EKS), | ||
| you can adjust the labels to be based on the name of your NodePools. | ||
|
|
||
| For example: | ||
|
|
||
| * `karpenter.sh/nodepool: stackable-operators` | ||
| * `karpenter.sh/nodepool: stackable-workloads` | ||
|
|
||
| ==== | ||
|
|
||
| Create a KinD config called `kind-config.yaml` containing: | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| kind: Cluster | ||
| apiVersion: kind.x-k8s.io/v1alpha4 | ||
| nodes: | ||
| - role: control-plane | ||
| - role: worker | ||
| labels: | ||
| nodepool: stackable-operators | ||
| - role: worker | ||
| labels: | ||
| nodepool: stackable-operators | ||
| - role: worker | ||
| labels: | ||
| nodepool: stackable-workloads | ||
| - role: worker | ||
| labels: | ||
| nodepool: stackable-workloads | ||
| ---- | ||
|
|
||
| Launch the cluster: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| kind create cluster --name stackable --config kind-config.yaml | ||
| ---- | ||
|
|
||
| You can see which nodes are in which _nodepool_ by using the following command: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| kubectl get nodes -o json | jq ' | ||
| .items[] | ||
| | .metadata.name as $name | ||
| | .metadata.labels["nodepool"] as $nodepool | ||
| | $nodepool//empty | ||
| | {"nodename": $name, "nodepool": $nodepool} | ||
| ' | ||
| ---- | ||
|
|
||
| == Prepare Helm Values for the Stackable Operators | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| Most Stackable operators use the same Helm Values structure, however Secret and | ||
| Listener operator differ slightly - which is what allows the components to be | ||
| configured independently of each other. | ||
| ==== | ||
|
|
||
| // TODO: Move these into files and include them (so we can run them easily) | ||
|
|
||
| [tabs] | ||
| ==== | ||
| Secret Operator:: | ||
| + | ||
| -- | ||
| Store the values in a file called `stackable-secret-operator.yaml`. | ||
|
|
||
| // TODO: Link to default values | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| controllerService: | ||
| nodeSelector: | ||
| nodepool: stackable-operators | ||
|
|
||
| csiNodeDriver: | ||
| # Node Drivers need to run on the same nodes as the workloads using them | ||
| nodeSelector: | ||
| nodepool: stackable-workloads | ||
| ---- | ||
|
|
||
| -- | ||
|
|
||
| Listener Operator:: | ||
| + | ||
| -- | ||
| Store the values in a file called `stackable-listener-operator.yaml`. | ||
|
|
||
| // TODO: Link to default values | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| csiProvisioner: | ||
| nodeSelector: | ||
| nodepool: stackable-operators | ||
|
|
||
| csiNodeDriver: | ||
| # Node Drivers need to run on the same nodes as the workloads using them | ||
| nodeSelector: | ||
| nodepool: stackable-workloads | ||
| ---- | ||
|
|
||
| -- | ||
|
|
||
| Remaining operators:: | ||
| + | ||
| -- | ||
| Store the values in a file called `stackable-operators.yaml`. | ||
|
|
||
| // TODO: Link to default values for remaining operators used in this guide | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| nodeSelector: | ||
| nodepool: stackable-operators | ||
| ---- | ||
|
|
||
| -- | ||
| ==== | ||
|
|
||
| NOTE: If you would like to run on nodes with taints, you can list `tolerations` next to the `nodeSelector`. | ||
|
|
||
| == Install the Stackable Operators | ||
|
|
||
| Now install the operators to the applicable node pools by using the Helm overrides | ||
|
|
||
| [tabs] | ||
| ==== | ||
| Secret Operator:: | ||
| + | ||
| -- | ||
| NOTE: This operator uses a specific values file. | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| helm install secret-operator \ | ||
| --version=0.0.0-dev \ | ||
| --values=stackable-secret-operator.yaml \ | ||
| oci://oci.stackable.tech/sdp-charts/secret-operator | ||
| ---- | ||
|
|
||
| -- | ||
|
|
||
| Listener Operator:: | ||
| + | ||
| -- | ||
| NOTE: This operator uses a specific values file. | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| helm install listener-operator \ | ||
| --version=0.0.0-dev \ | ||
| --values=stackable-listener-operator.yaml \ | ||
| oci://oci.stackable.tech/sdp-charts/listener-operator | ||
| ---- | ||
|
|
||
| -- | ||
|
|
||
| Remaining operators:: | ||
| + | ||
| -- | ||
| NOTE: These operator use the same values file. | ||
|
NickLarsenNZ marked this conversation as resolved.
Outdated
|
||
|
|
||
| [source,bash] | ||
| ---- | ||
| helm install commons-operator \ | ||
| --version=0.0.0-dev \ | ||
| --values=stackable-operators.yaml \ | ||
| oci://oci.stackable.tech/sdp-charts/commons-operator | ||
|
|
||
| helm install nifi-operator \ | ||
| --version=0.0.0-dev \ | ||
| --values=stackable-operators.yaml \ | ||
| oci://oci.stackable.tech/sdp-charts/nifi-operator | ||
| ---- | ||
|
|
||
| -- | ||
| ==== | ||
|
|
||
| You should now see that the operators are running on the `stackable-operator` nodes, while the CSI drivers are running on the `stackable-workload` nodes. | ||
|
|
||
| Pods running on the `stackable-operators` node pool: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| OPERATORS_NODEPOOL=$(kubectl get nodes -l nodepool=stackable-operators -o jsonpath="{.items[*].metadata.name}" | tr ' ' ',') | ||
| echo "Nodes in operators pool: $OPERATORS_NODEPOOL\n" | ||
| kubectl get pods -o json | jq --raw-output --arg nodepool "$OPERATORS_NODEPOOL" '.items[] | .metadata.name as $podname | .spec.nodeName as $nodename | select($nodename | IN($nodepool | split(",")[])) | $podname' | ||
| ---- | ||
|
NickLarsenNZ marked this conversation as resolved.
|
||
|
|
||
| You should see similar output showing the Stackable Operators are running only on nodes with the label `nodepool: stackable-operators`. | ||
|
|
||
| [source] | ||
| ---- | ||
| Nodes in operators pool: stackable-worker,stackable-worker2 | ||
|
|
||
| commons-operator-deployment-674c469b47-nm5vb | ||
| listener-operator-csi-provisioner-85b686d48-hv5kf | ||
| nifi-operator-deployment-7c59778bb8-r26b8 | ||
| secret-operator-66b85c669d-7hsxs | ||
| ---- | ||
|
|
||
| Pods running on the `stackable-workloads` node pool: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| WORKLOADS_NODEPOOL=$(kubectl get nodes -l nodepool=stackable-workloads -o jsonpath="{.items[*].metadata.name}" | tr ' ' ',') | ||
| echo "Nodes in workloads pool: $WORKLOADS_NODEPOOL\n" | ||
| kubectl get pods -o json | jq --raw-output --arg nodepool "$WORKLOADS_NODEPOOL" '.items[] | .metadata.name as $podname | .spec.nodeName as $nodename | select($nodename | IN($nodepool | split(",")[])) | $podname' | ||
|
NickLarsenNZ marked this conversation as resolved.
Outdated
|
||
| ---- | ||
|
|
||
| You should see similar output showing the Stackable CSI Node Drivers are running only on nodes with the label `nodepool: stackable-workloads`. | ||
|
|
||
| [source] | ||
| ---- | ||
| Nodes in workloads pool: stackable-worker3,stackable-worker4 | ||
|
|
||
| listener-operator-csi-node-driver-lv5r4 | ||
| listener-operator-csi-node-driver-vdzsq | ||
| secret-operator-csi-node-driver-d8sqw | ||
| secret-operator-csi-node-driver-zkrv6 | ||
| ---- | ||
|
|
||
| The CSI Node Drivers register as such. | ||
| This can be seen with the driver count being 2 (one for listener-operator volumes, and one for secret-operator volumes) for nodes in the workloads pool: | ||
|
|
||
| [source,console] | ||
| ---- | ||
| $ kubectl get csinodes | ||
| NAME DRIVERS AGE | ||
| stackable-control-plane 0 3h40m | ||
| stackable-worker 0 3h39m | ||
| stackable-worker2 0 3h39m | ||
| stackable-worker3 2 3h39m | ||
| stackable-worker4 2 3h39m | ||
| ---- | ||
|
|
||
| == Install a workload | ||
|
|
||
| We'll install a NiFi cluster onto a `stackable-workload` node. Create a new file called `nifi.yaml` with the following contents: | ||
| // This is taken from the NiFi Getting Started, but with some modifications. | ||
| // TODO: Update nifi getting started to remove zookeeper. | ||
|
NickLarsenNZ marked this conversation as resolved.
Outdated
|
||
|
|
||
| [source,yaml] | ||
| ---- | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: simple-admin-credentials | ||
| stringData: | ||
| admin: admin | ||
| --- | ||
| apiVersion: authentication.stackable.tech/v1alpha1 | ||
| kind: AuthenticationClass | ||
| metadata: | ||
| name: simple-nifi-users | ||
| spec: | ||
| provider: | ||
| static: | ||
| userCredentialsSecret: | ||
| name: simple-admin-credentials | ||
| --- | ||
| apiVersion: nifi.stackable.tech/v1alpha1 | ||
| kind: NifiCluster | ||
| metadata: | ||
| name: simple-nifi | ||
| spec: | ||
| image: | ||
| productVersion: 2.6.0 | ||
| clusterConfig: | ||
| authentication: | ||
| - authenticationClass: simple-nifi-users | ||
| sensitiveProperties: | ||
| keySecret: nifi-sensitive-property-key | ||
| autoGenerate: true | ||
| nodes: | ||
| roleGroups: | ||
| default: | ||
| replicas: 1 | ||
| config: | ||
| # Run NiFi nodes in the workloads pool | ||
| affinity: | ||
| nodeSelector: | ||
| nodepool: stackable-workloads | ||
| ---- | ||
|
|
||
| Apply it to Kubernetes: | ||
|
|
||
| [source,console] | ||
| ---- | ||
| $ kubectl apply -f nifi.yaml | ||
| ---- | ||
|
|
||
| Then take a look at the pods running on nodes with the label `nodepool: stackable-workloads`: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| WORKLOADS_NODEPOOL=$(kubectl get nodes -l nodepool=stackable-workloads -o jsonpath="{.items[*].metadata.name}" | tr ' ' ',') | ||
| echo "Nodes in workloads pool: $WORKLOADS_NODEPOOL\n" | ||
| kubectl get pods -o json | jq --raw-output --arg nodepool "$WORKLOADS_NODEPOOL" '.items[] | .metadata.name as $podname | .spec.nodeName as $nodename | select($nodename | IN($nodepool | split(",")[])) | $podname' | ||
|
NickLarsenNZ marked this conversation as resolved.
Outdated
|
||
| ---- | ||
|
|
||
| You should see similar output as last time, but now with the NiFi pod. | ||
|
|
||
| [source] | ||
| ---- | ||
| Nodes in workloads pool: stackable-worker3,stackable-worker4 | ||
|
|
||
| listener-operator-csi-node-driver-lv5r4 | ||
| listener-operator-csi-node-driver-vdzsq | ||
| secret-operator-csi-node-driver-d8sqw | ||
| secret-operator-csi-node-driver-zkrv6 | ||
| simple-nifi-node-default-0 | ||
| ---- | ||
|
|
||
| == Cleanup | ||
|
|
||
| Once done, you can delete the KinD cluster like so: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| kind delete cluster --name stackable | ||
| ---- | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.