mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
149 lines
3.2 KiB
Plaintext
149 lines
3.2 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * networking/networking_operators/aws-load-balancer-operator.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="aws-load-balancer-operator-validate-install_{context}"]
|
|
= Validating Operator installation
|
|
|
|
Deploy a basic sample application and create ingress and load balancing services to confirm that the AWS Load Balancer Operator and Controller deployed correctly.
|
|
|
|
.Procedure
|
|
. Create a new project:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc new-project hello-world
|
|
----
|
|
|
|
. Create a new `hello-world` application based on the `hello-openshift` image:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc new-app -n hello-world --image=docker.io/openshift/hello-openshift
|
|
----
|
|
|
|
. Configure a `NodePort` service for an AWS Application Load Balancer (ALB) to connect to:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ cat << EOF | oc apply -f -
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: hello-openshift-nodeport
|
|
namespace: hello-world
|
|
spec:
|
|
ports:
|
|
- port: 80
|
|
targetPort: 8080
|
|
protocol: TCP
|
|
type: NodePort
|
|
selector:
|
|
deployment: hello-openshift
|
|
EOF
|
|
----
|
|
|
|
. Deploy an AWS ALB for the application:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ cat << EOF | oc apply -f -
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: hello-openshift-alb
|
|
namespace: hello-world
|
|
annotations:
|
|
alb.ingress.kubernetes.io/scheme: internet-facing
|
|
spec:
|
|
ingressClassName: alb
|
|
rules:
|
|
- http:
|
|
paths:
|
|
- path: /
|
|
pathType: Exact
|
|
backend:
|
|
service:
|
|
name: hello-openshift-nodeport
|
|
port:
|
|
number: 80
|
|
EOF
|
|
----
|
|
|
|
. Test access to the AWS ALB endpoint for the application:
|
|
+
|
|
[NOTE]
|
|
====
|
|
ALB provisioning takes a few minutes. If you receive an error that says `curl: (6) Could not resolve host`, please wait and try again.
|
|
====
|
|
+
|
|
[source,termnial]
|
|
----
|
|
$ ALB_INGRESS=$(oc -n hello-world get ingress hello-openshift-alb \
|
|
-o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
|
|
----
|
|
+
|
|
[source,termnial]
|
|
----
|
|
$ curl "http://${ALB_INGRESS}"
|
|
----
|
|
+
|
|
.Example output
|
|
[source,text]
|
|
----
|
|
Hello OpenShift!
|
|
----
|
|
|
|
. Deploy an AWS Network Load Balancer (NLB) for the application:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ cat << EOF | oc apply -f -
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: hello-openshift-nlb
|
|
namespace: hello-world
|
|
annotations:
|
|
service.beta.kubernetes.io/aws-load-balancer-type: external
|
|
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: instance
|
|
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
|
|
spec:
|
|
ports:
|
|
- port: 80
|
|
targetPort: 8080
|
|
protocol: TCP
|
|
type: LoadBalancer
|
|
selector:
|
|
deployment: hello-openshift
|
|
EOF
|
|
----
|
|
|
|
. Test access to the NLB endpoint for the application:
|
|
+
|
|
[NOTE]
|
|
====
|
|
NLB provisioning takes a few minutes. If you receive an error that says `curl: (6) Could not resolve host`, please wait and try again.
|
|
====
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ NLB=$(oc -n hello-world get service hello-openshift-nlb \
|
|
-o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
|
|
----
|
|
+
|
|
[source,termnial]
|
|
----
|
|
$ curl "http://${NLB}"
|
|
----
|
|
+
|
|
Expected output shows `Hello OpenShift!`.
|
|
|
|
. You can now delete the sample application and all resources in the `hello-world` namespace.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc delete project hello-world
|
|
----
|