Skip to content

Commit 9147fad

Browse files
committed
docs(getting_started): Update guide to use the Listener address
1 parent e3a4790 commit 9147fad

3 files changed

Lines changed: 59 additions & 142 deletions

File tree

docs/modules/nifi/examples/getting_started/getting_started.sh

Lines changed: 33 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,6 @@ exit 1
5050
;;
5151
esac
5252

53-
internal=true
54-
if [ $# -eq 2 ]
55-
then
56-
case "$2" in
57-
"InternalIP")
58-
internal=true
59-
;;
60-
"ExternalIP")
61-
internal=false
62-
;;
63-
*)
64-
echo "Need to provide 'InternalIP' or 'ExternalIP' as the connection type argument."
65-
exit 1
66-
;;
67-
esac
68-
fi
69-
7053
echo "Installing ZooKeeper"
7154
# tag::install-zookeeper[]
7255
kubectl apply -f - <<EOF
@@ -153,7 +136,6 @@ spec:
153136
roleGroups:
154137
default:
155138
replicas: 1
156-
157139
EOF
158140
# end::install-nifi[]
159141

@@ -168,55 +150,39 @@ kubectl wait -l statefulset.kubernetes.io/pod-name=simple-nifi-node-default-0 \
168150
sleep 5
169151

170152
case "$1" in
171-
"helm")
172-
173-
echo "Get a single node where a NiFi pod is running"
174-
# tag::get-nifi-node-name[]
175-
nifi_node_name=$(kubectl get endpoints simple-nifi --output=jsonpath='{.subsets[0].addresses[0].nodeName}') && \
176-
echo "NodeName: $nifi_node_name"
177-
# end::get-nifi-node-name[]
178-
179-
180-
if [ "$internal" = true ] ; then
181-
echo "List $nifi_node_name node internal ip"
182-
# tag::get-nifi-node-ip-internal[]
183-
nifi_node_ip=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name==\"$nifi_node_name\")].status.addresses[?(@.type==\"InternalIP\")].address}") && \
184-
echo "NodeIp: $nifi_node_ip"
185-
# end::get-nifi-node-ip-internal[]
186-
else
187-
echo "List $nifi_node_name node external ip"
188-
# tag::get-nifi-node-ip-external[]
189-
nifi_node_ip=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name==\"$nifi_node_name\")].status.addresses[?(@.type==\"ExternalIP\")].address}") && \
190-
echo "NodeIp: $nifi_node_ip"
191-
# end::get-nifi-node-ip-external[]
192-
fi
193-
194-
echo "Get node port from service"
195-
# tag::get-nifi-service-port[]
196-
nifi_service_port=$(kubectl get service -o jsonpath="{.items[?(@.metadata.name==\"simple-nifi\")].spec.ports[?(@.name==\"https\")].nodePort}") && \
197-
echo "NodePort: $nifi_service_port"
198-
# end::get-nifi-service-port[]
199-
200-
echo "Create NiFi url"
201-
# tag::create-nifi-url[]
202-
nifi_url="https://$nifi_node_ip:$nifi_service_port" && \
203-
echo "NiFi web interface: $nifi_url"
204-
# end::create-nifi-url[]
205-
206-
;;
207-
"stackablectl")
208-
209-
echo "Getting NiFi endpoint with stackablectl ..."
210-
# tag::stackablectl-nifi-url[]
211-
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints["node-https"]')
212-
# end::stackablectl-nifi-url[]
213-
echo "Endpoint: $nifi_url"
214-
215-
;;
216-
*)
217-
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"
218-
exit 1
219-
;;
153+
"helm")
154+
echo "Getting the NiFi endpoint with kubectl"
155+
156+
echo "Get first node address from Listener"
157+
# tag::get-nifi-node-address[]
158+
nifi_node_address=$(kubectl get listener simple-nifi-node -o 'jsonpath={.status.ingressAddresses[0].address}') && \
159+
echo "NodeAddress: $nifi_node_address"
160+
# end::get-nifi-node-address[]
161+
162+
echo "Get HTTPS node port from Listener"
163+
# tag::get-nifi-node-port[]
164+
nifi_node_port=$(kubectl get listener simple-nifi-node -o 'jsonpath={.status.nodePorts.https}') && \
165+
echo "NodePort: $nifi_node_port"
166+
# end::get-nifi-node-port[]
167+
168+
echo "Create NiFi url"
169+
# tag::create-nifi-url[]
170+
nifi_url="https://$nifi_node_address:$nifi_node_port" && \
171+
echo "NiFi web interface: $nifi_url"
172+
# end::create-nifi-url[]
173+
174+
;;
175+
"stackablectl")
176+
echo "Getting NiFi endpoint with stackablectl ..."
177+
# tag::stackablectl-nifi-url[]
178+
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints["node-https"]')
179+
# end::stackablectl-nifi-url[]
180+
echo "Endpoint: $nifi_url"
181+
;;
182+
*)
183+
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"
184+
exit 1
185+
;;
220186
esac
221187

222188
echo "Starting nifi tests"

docs/modules/nifi/examples/getting_started/getting_started.sh.j2

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,6 @@ exit 1
5050
;;
5151
esac
5252

53-
internal=true
54-
if [ $# -eq 2 ]
55-
then
56-
case "$2" in
57-
"InternalIP")
58-
internal=true
59-
;;
60-
"ExternalIP")
61-
internal=false
62-
;;
63-
*)
64-
echo "Need to provide 'InternalIP' or 'ExternalIP' as the connection type argument."
65-
exit 1
66-
;;
67-
esac
68-
fi
69-
7053
echo "Installing ZooKeeper"
7154
# tag::install-zookeeper[]
7255
kubectl apply -f - <<EOF
@@ -168,49 +151,33 @@ sleep 5
168151

169152
case "$1" in
170153
"helm")
154+
echo "Getting the NiFi endpoint with kubectl"
171155

172-
echo "Get a single node where a NiFi pod is running"
173-
# tag::get-nifi-node-name[]
174-
nifi_node_name=$(kubectl get endpoints simple-nifi --output=jsonpath='{.subsets[0].addresses[0].nodeName}') && \
175-
echo "NodeName: $nifi_node_name"
176-
# end::get-nifi-node-name[]
177-
178-
179-
if [ "$internal" = true ] ; then
180-
echo "List $nifi_node_name node internal ip"
181-
# tag::get-nifi-node-ip-internal[]
182-
nifi_node_ip=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name==\"$nifi_node_name\")].status.addresses[?(@.type==\"InternalIP\")].address}") && \
183-
echo "NodeIp: $nifi_node_ip"
184-
# end::get-nifi-node-ip-internal[]
185-
else
186-
echo "List $nifi_node_name node external ip"
187-
# tag::get-nifi-node-ip-external[]
188-
nifi_node_ip=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name==\"$nifi_node_name\")].status.addresses[?(@.type==\"ExternalIP\")].address}") && \
189-
echo "NodeIp: $nifi_node_ip"
190-
# end::get-nifi-node-ip-external[]
191-
fi
156+
echo "Get first node address from Listener"
157+
# tag::get-nifi-node-address[]
158+
nifi_node_address=$(kubectl get listener simple-nifi-node -o 'jsonpath={.status.ingressAddresses[0].address}') && \
159+
echo "NodeAddress: $nifi_node_address"
160+
# end::get-nifi-node-address[]
192161

193-
echo "Get node port from service"
194-
# tag::get-nifi-service-port[]
195-
nifi_service_port=$(kubectl get service -o jsonpath="{.items[?(@.metadata.name==\"simple-nifi\")].spec.ports[?(@.name==\"https\")].nodePort}") && \
196-
echo "NodePort: $nifi_service_port"
197-
# end::get-nifi-service-port[]
162+
echo "Get HTTPS node port from Listener"
163+
# tag::get-nifi-node-port[]
164+
nifi_node_port=$(kubectl get listener simple-nifi-node -o 'jsonpath={.status.nodePorts.https}') && \
165+
echo "NodePort: $nifi_node_port"
166+
# end::get-nifi-node-port[]
198167

199168
echo "Create NiFi url"
200169
# tag::create-nifi-url[]
201-
nifi_url="https://$nifi_node_ip:$nifi_service_port" && \
170+
nifi_url="https://$nifi_node_address:$nifi_node_port" && \
202171
echo "NiFi web interface: $nifi_url"
203172
# end::create-nifi-url[]
204173

205174
;;
206175
"stackablectl")
207-
208176
echo "Getting NiFi endpoint with stackablectl ..."
209177
# tag::stackablectl-nifi-url[]
210178
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints["node-https"]')
211179
# end::stackablectl-nifi-url[]
212180
echo "Endpoint: $nifi_url"
213-
214181
;;
215182
*)
216183
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"

docs/modules/nifi/pages/getting_started/first_steps.adoc

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,9 @@ stackablectl stacklet list
9292
which should return something like this:
9393

9494
----
95-
PRODUCT NAME NAMESPACE ENDPOINTS EXTRA INFOS
96-
97-
nifi simple-nifi default https https://172.18.0.3:32595
98-
99-
zookeeper simple-zk default zk 172.18.0.3:30173
95+
PRODUCT NAME NAMESPACE ENDPOINTS CONDITIONS
96+
nifi simple-nifi default node-https https://172.18.0.2:30528 Available, Reconciling, Running
97+
zookeeper simple-zk default server-zk simple-zk-server.default.svc.cluster.local:2282 Available, Reconciling, Running
10098
----
10199

102100
You can also use the `json` output and parse the endpoint:
@@ -106,54 +104,40 @@ You can also use the `json` output and parse the endpoint:
106104
include::example$getting_started/getting_started.sh[tag=stackablectl-nifi-url]
107105
----
108106

109-
Then connect to `https://172.18.0.3:32595/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.
107+
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.
110108

111109
image::nifi-web-ui.png[]
112110

113111
==== Via kubectl
114112

115-
Extracting the IP and port via `kubectl` is cumbersome. We recommend using `stackablectl` instead. The following `kubectl` commands store their output for further use in a variable and write its content to stdout afterwards. Make sure to run these commands in the same terminal:
116-
117-
[source,bash]
118-
----
119-
include::example$getting_started/getting_started.sh[tag=get-nifi-node-name]
120-
----
121-
122-
which should output a single node name where a NiFi pod is scheduled:
123-
124-
[source]
125-
----
126-
NodeName: kind-worker
127-
----
113+
You can also extract the IP and port from the xref:listener-operator:listener.adoc[Listener] status via `kubectl`.
128114

129-
Retrieve the IP of that node:
115+
Retrieve the Kubernetes node address where the NiFi pod is running:
130116

131117
[source,bash]
132118
----
133-
include::example$getting_started/getting_started.sh[tag=get-nifi-node-ip-internal]
119+
include::example$getting_started/getting_started.sh[tag=get-nifi-node-address]
134120
----
135121

136-
which should output the internal IP of that node:
122+
which should output the Kubernetes node address:
137123

138124
[source]
139125
----
140-
NodeIp: 172.18.0.3
126+
NodeAddress: 172.18.0.2
141127
----
142128

143-
You might need to replace `InternalIP` with `ExternalIP` depending on how you connect to your Kubernetes cluster.
144-
145-
Finally, retrieve the NodePort of the `simple-nifi` service:
129+
Finally, retrieve the NodePort of the `simple-nifi` listener:
146130

147131
[source,bash]
148132
----
149-
include::example$getting_started/getting_started.sh[tag=get-nifi-service-port]
133+
include::example$getting_started/getting_started.sh[tag=get-nifi-node-port]
150134
----
151135

152136
which should output the NodePort:
153137

154138
[source]
155139
----
156-
NodePort: 32595
140+
NodePort: 30528
157141
----
158142

159143
Now build the full URL:
@@ -167,10 +151,10 @@ which should output a URL to connect to the NiFi web interface:
167151

168152
[source]
169153
----
170-
NiFi web interface: https://172.18.0.3:32595
154+
NiFi web interface: https://172.18.0.2:30528
171155
----
172156

173-
Then connect to `https://172.18.0.3:32595/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.
157+
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.
174158

175159
== What's next
176160

0 commit comments

Comments
 (0)