7.3. 배포 검증
새 프로젝트를 생성합니다.
$ oc new-project hello-worldhello world 애플리케이션을 배포합니다.
$ oc new-app -n hello-world --image=docker.io/openshift/hello-openshiftAWS ALB에 연결하도록 NodePort 서비스를 구성합니다.
$ 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 EOFAWS Load Balancer Operator를 사용하여 AWS ALB를 배포합니다.
$ 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 EOFAWS ALB Ingress 끝점을 curl하여 hello world 애플리케이션에 액세스할 수 있는지 확인합니다.
참고AWS ALB 프로비저닝에는 몇 분이 걸립니다.
curl: (6) 호스트를 해결할 수 없는오류가 발생하면 기다렸다가 다시 시도하십시오.$ INGRESS=$(oc -n hello-world get ingress hello-openshift-alb \ -o jsonpath='{.status.loadBalancer.ingress[0].hostname}') $ curl "http://${INGRESS}"출력 예
Hello OpenShift!hello world 애플리케이션에 사용할 AWS NLB를 배포합니다.
$ 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 EOFAWS NLB 끝점을 테스트합니다.
참고NLB 프로비저닝에는 몇 분이 걸립니다.
curl: (6) 호스트를 해결할 수 없는오류가 발생하면 기다렸다가 다시 시도하십시오.$ NLB=$(oc -n hello-world get service hello-openshift-nlb \ -o jsonpath='{.status.loadBalancer.ingress[0].hostname}') $ curl "http://${NLB}"출력 예
Hello OpenShift!