Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 19 additions & 79 deletions docs/modules/nifi/examples/getting_started/getting_started.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ echo "Installing Operators with Helm"
helm install --wait commons-operator oci://oci.stackable.tech/sdp-charts/commons-operator --version 0.0.0-dev
helm install --wait secret-operator oci://oci.stackable.tech/sdp-charts/secret-operator --version 0.0.0-dev
helm install --wait listener-operator oci://oci.stackable.tech/sdp-charts/listener-operator --version 0.0.0-dev
helm install --wait zookeeper-operator oci://oci.stackable.tech/sdp-charts/zookeeper-operator --version 0.0.0-dev
helm install --wait nifi-operator oci://oci.stackable.tech/sdp-charts/nifi-operator --version 0.0.0-dev
# end::helm-install-operators[]
;;
Expand All @@ -40,7 +39,6 @@ stackablectl operator install \
commons=0.0.0-dev \
secret=0.0.0-dev \
listener=0.0.0-dev \
zookeeper=0.0.0-dev \
nifi=0.0.0-dev
# end::stackablectl-install-operators[]
;;
Expand All @@ -50,45 +48,6 @@ exit 1
;;
esac

echo "Installing ZooKeeper"
# tag::install-zookeeper[]
kubectl apply -f - <<EOF
---
apiVersion: zookeeper.stackable.tech/v1alpha1
kind: ZookeeperCluster
metadata:
name: simple-zk
spec:
image:
productVersion: 3.9.3
servers:
roleGroups:
default:
replicas: 1
EOF
# end::install-zookeeper[]

echo "Create a ZNode"
# tag::install-znode[]
kubectl apply -f - <<EOF
---
apiVersion: zookeeper.stackable.tech/v1alpha1
kind: ZookeeperZnode
metadata:
name: simple-nifi-znode
spec:
clusterRef:
name: simple-zk
EOF
# end::install-znode[]

sleep 15

echo "Awaiting ZooKeeper rollout finish"
# tag::watch-zookeeper-rollout[]
kubectl rollout status --watch --timeout=5m statefulset/simple-zk-server-default
# end::watch-zookeeper-rollout[]

echo "Create NiFi admin credentials"
# tag::install-nifi-credentials[]
kubectl apply -f - <<EOF
Expand Down Expand Up @@ -129,7 +88,6 @@ spec:
sensitiveProperties:
keySecret: nifi-sensitive-property-key
autoGenerate: true
zookeeperConfigMapName: simple-nifi-znode
nodes:
roleConfig:
listenerClass: external-unstable
Expand All @@ -139,50 +97,32 @@ spec:
EOF
# end::install-nifi[]

sleep 5

echo "Awaiting NiFi rollout finish"
# tag::wait-nifi-rollout[]
kubectl wait -l statefulset.kubernetes.io/pod-name=simple-nifi-node-default-0 \
--for=condition=ready pod --timeout=1200s
kubectl wait --for=condition=available --timeout=20m nificluster/simple-nifi
# end::wait-nifi-rollout[]

sleep 5

case "$1" in
"helm")
echo "Getting the NiFi endpoint with kubectl"

echo "Get first node address from Listener"
# tag::get-nifi-node-address[]
nifi_node_address=$(kubectl get listener simple-nifi-node -o 'jsonpath={.status.ingressAddresses[0].address}') && \
echo "NodeAddress: $nifi_node_address"
# end::get-nifi-node-address[]

echo "Get HTTPS node port from Listener"
# tag::get-nifi-node-port[]
nifi_node_port=$(kubectl get listener simple-nifi-node -o 'jsonpath={.status.nodePorts.https}') && \
echo "NodePort: $nifi_node_port"
# end::get-nifi-node-port[]
"helm")
echo "Getting the NiFi URL with kubectl"

echo "Create NiFi url"
# tag::create-nifi-url[]
nifi_url="https://$nifi_node_address:$nifi_node_port" && \
echo "NiFi web interface: $nifi_url"
# end::create-nifi-url[]
# tag::get-nifi-url[]
nifi_url=$(kubectl get listener simple-nifi-node -o 'jsonpath=https://{.status.ingressAddresses[0].address}:{.status.ingressAddresses[0].ports.https}') && \
echo "NiFi URL: $nifi_url"
# end::get-nifi-url[]
Comment thread
sbernauer marked this conversation as resolved.
Outdated

;;
"stackablectl")
echo "Getting NiFi endpoint with stackablectl ..."
# tag::stackablectl-nifi-url[]
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints["node-https"]')
# end::stackablectl-nifi-url[]
echo "Endpoint: $nifi_url"
;;
*)
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"
exit 1
;;
;;
"stackablectl")
echo "Getting NiFi URL with stackablectl ..."
# tag::stackablectl-nifi-url[]
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints["node-https"]')
# end::stackablectl-nifi-url[]
echo "NiFi URL: $nifi_url"
;;
*)
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"
exit 1
;;
Comment thread
sbernauer marked this conversation as resolved.
esac

echo "Starting nifi tests"
Expand Down
76 changes: 8 additions & 68 deletions docs/modules/nifi/examples/getting_started/getting_started.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ echo "Installing Operators with Helm"
helm install --wait commons-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/commons-operator --version {{ versions.commons }}
helm install --wait secret-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/secret-operator --version {{ versions.secret }}
helm install --wait listener-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/listener-operator --version {{ versions.listener }}
helm install --wait zookeeper-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/zookeeper-operator --version {{ versions.zookeeper }}
helm install --wait nifi-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/nifi-operator --version {{ versions.nifi }}
# end::helm-install-operators[]
;;
Expand All @@ -40,7 +39,6 @@ stackablectl operator install \
commons={{ versions.commons }} \
secret={{ versions.secret }} \
listener={{ versions.listener }} \
zookeeper={{ versions.zookeeper }} \
nifi={{ versions.nifi }}
# end::stackablectl-install-operators[]
;;
Expand All @@ -50,45 +48,6 @@ exit 1
;;
esac

echo "Installing ZooKeeper"
# tag::install-zookeeper[]
kubectl apply -f - <<EOF
---
apiVersion: zookeeper.stackable.tech/v1alpha1
kind: ZookeeperCluster
metadata:
name: simple-zk
spec:
image:
productVersion: 3.9.3
servers:
roleGroups:
default:
replicas: 1
EOF
# end::install-zookeeper[]

echo "Create a ZNode"
# tag::install-znode[]
kubectl apply -f - <<EOF
---
apiVersion: zookeeper.stackable.tech/v1alpha1
kind: ZookeeperZnode
metadata:
name: simple-nifi-znode
spec:
clusterRef:
name: simple-zk
EOF
# end::install-znode[]

sleep 15

echo "Awaiting ZooKeeper rollout finish"
# tag::watch-zookeeper-rollout[]
kubectl rollout status --watch --timeout=5m statefulset/simple-zk-server-default
# end::watch-zookeeper-rollout[]

echo "Create NiFi admin credentials"
# tag::install-nifi-credentials[]
kubectl apply -f - <<EOF
Expand Down Expand Up @@ -129,7 +88,6 @@ spec:
sensitiveProperties:
keySecret: nifi-sensitive-property-key
autoGenerate: true
zookeeperConfigMapName: simple-nifi-znode
nodes:
roleConfig:
listenerClass: external-unstable
Expand All @@ -139,45 +97,27 @@ spec:
EOF
# end::install-nifi[]

sleep 5

echo "Awaiting NiFi rollout finish"
# tag::wait-nifi-rollout[]
kubectl wait -l statefulset.kubernetes.io/pod-name=simple-nifi-node-default-0 \
--for=condition=ready pod --timeout=1200s
kubectl wait --for=condition=available --timeout=20m nificluster/simple-nifi
# end::wait-nifi-rollout[]

sleep 5

case "$1" in
"helm")
echo "Getting the NiFi endpoint with kubectl"

echo "Get first node address from Listener"
# tag::get-nifi-node-address[]
nifi_node_address=$(kubectl get listener simple-nifi-node -o 'jsonpath={.status.ingressAddresses[0].address}') && \
echo "NodeAddress: $nifi_node_address"
# end::get-nifi-node-address[]

echo "Get HTTPS node port from Listener"
# tag::get-nifi-node-port[]
nifi_node_port=$(kubectl get listener simple-nifi-node -o 'jsonpath={.status.nodePorts.https}') && \
echo "NodePort: $nifi_node_port"
# end::get-nifi-node-port[]
echo "Getting the NiFi URL with kubectl"

echo "Create NiFi url"
# tag::create-nifi-url[]
nifi_url="https://$nifi_node_address:$nifi_node_port" && \
echo "NiFi web interface: $nifi_url"
# end::create-nifi-url[]
# tag::get-nifi-url[]
nifi_url=$(kubectl get listener simple-nifi-node -o 'jsonpath=https://{.status.ingressAddresses[0].address}:{.status.ingressAddresses[0].ports.https}') && \
echo "NiFi URL: $nifi_url"
# end::get-nifi-url[]

;;
"stackablectl")
echo "Getting NiFi endpoint with stackablectl ..."
echo "Getting NiFi URL with stackablectl ..."
# tag::stackablectl-nifi-url[]
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints["node-https"]')
# end::stackablectl-nifi-url[]
echo "Endpoint: $nifi_url"
echo "NiFi URL: $nifi_url"
;;
*)
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"
Expand Down
76 changes: 10 additions & 66 deletions docs/modules/nifi/pages/getting_started/first_steps.adoc
Original file line number Diff line number Diff line change
@@ -1,38 +1,13 @@
= First steps
:description: Deploy Apache NiFi and ZooKeeper on Kubernetes using manifest files. Verify setup and access NiFi's web interface with stackablectl or kubectl.
:description: Deploy Apache NiFi on Kubernetes using manifest files. Verify setup and access NiFi's web interface with stackablectl or kubectl.

After going through the xref:getting_started/installation.adoc[] section and having installed all the operators, you deploy a NiFi cluster and the required dependencies.
Afterward you can <<_verify_that_it_works, verify that it works>> by querying the REST API.

== Setup

Two things need to be installed to create a NiFi cluster:

* A ZooKeeper cluster for internal use by NiFi
* The NiFi cluster itself

Create them in this order, each one is created by applying a manifest file.
The operators create the resources according to the manifest.

=== Apache ZooKeeper

To create a ZooKeeper instance run the following command:

[source,bash]
----
include::example$getting_started/getting_started.sh[tag=install-zookeeper]
----

Create a Znode object:

[source,bash]
----
include::example$getting_started/getting_started.sh[tag=install-znode]
----

The xref:zookeeper:znodes.adoc[ZNode] makes sure that the NiFi cluster operates in its own separated directory in ZooKeeper.

=== Apache NiFi
We are going to install a NiFi cluster by applying a manifest file.
The operators create the resources according to the manifests.

The NiFi cluster requires authentication.
Create a set of credentials for this purpose:
Expand All @@ -42,7 +17,7 @@ Create a set of credentials for this purpose:
include::example$getting_started/getting_started.sh[tag=install-nifi-credentials]
----

Finally create a NiFi instance:
Afterwards create a NiFi instance:

[source,bash]
----
Expand Down Expand Up @@ -92,9 +67,8 @@ stackablectl stacklet list
which should return something like this:

----
PRODUCT NAME NAMESPACE ENDPOINTS CONDITIONS
nifi simple-nifi default node-https https://172.18.0.2:30528 Available, Reconciling, Running
zookeeper simple-zk default server-zk simple-zk-server.default.svc.cluster.local:2282 Available, Reconciling, Running
PRODUCT NAME NAMESPACE ENDPOINTS CONDITIONS
nifi simple-nifi default node-https https://172.18.0.2:30528 Available, Reconciling, Running
----

You can also use the `json` output and parse the endpoint:
Expand All @@ -110,48 +84,18 @@ image::nifi-web-ui.png[]

==== Via kubectl

You can also extract the IP and port from the xref:listener-operator:listener.adoc[Listener] status via `kubectl`.

Retrieve the Kubernetes node address where the NiFi pod is running:

[source,bash]
----
include::example$getting_started/getting_started.sh[tag=get-nifi-node-address]
----

which should output the Kubernetes node address:

[source]
----
NodeAddress: 172.18.0.2
----

Finally, retrieve the NodePort of the `simple-nifi` listener:

[source,bash]
----
include::example$getting_started/getting_started.sh[tag=get-nifi-node-port]
----

which should output the NodePort:

[source]
----
NodePort: 30528
----

Now build the full URL:
You can also extract the endpoint from the xref:listener-operator:listener.adoc[Listener] status via `kubectl`:

[source,bash]
----
include::example$getting_started/getting_started.sh[tag=create-nifi-url]
include::example$getting_started/getting_started.sh[tag=get-nifi-url]
----

which should output a URL to connect to the NiFi web interface:
should output a URL to connect to the NiFi web interface:

[source]
----
NiFi web interface: https://172.18.0.2:30528
NiFi URL: https://172.18.0.2:30528
----

Then connect to `https://172.18.0.2:30528/nifi` and you should see the NiFi web login. After providing the username `admin` and password `admin` you are redirected to the NiFi web interface.
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/nifi/pages/getting_started/installation.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
= Installation
:description: Install the Stackable operator for Apache NiFi and its dependencies using stackablectl or Helm. Follow steps for a complete setup on Kubernetes.

On this page you install the Stackable operator for Apache NiFi and operators for its dependencies -- ZooKeeper --
as well as the commons, secret and listener operator which are required by all Stackable operators.
On this page you install the Stackable operator for Apache NiFi as well as the commons, secret and listener operator,
which are required by all Stackable operators.

There are multiple ways to install the Stackable operators.
xref:management:stackablectl:index.adoc[] is the preferred way, but Helm is also supported.
Expand Down