티스토리 뷰

openshift

[OpenShift] nginx 서비스 배포

넷오빠 2025. 11. 19. 17:08

 

 

OpenShift 에 Nginx 서비스 배포

- 빠른 생성(Yaml 을 통한 간단 베포)

 

 

 

Nginx 배포를 위한 Yaml

# nginx-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata: 
  name: nginx-deployment
  namespace: default      # 오픈시프트에 생성되어있는 namespace 확인
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  namespace: default   # 오픈시프트에 생성되어있는 namespace 확인
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  type: LoadBalancer # 또는 NodePort

 

 

Nginx  배포 상태

 

 

Nginx  서비스 노출 (openshift route리소스 활용)

# nginx service 용 라우트 생성
oc create -n default route edge nginx-route --service=nginx-service --port=80

 

 

도메인 라우팅 설정확인

oc get route nginx-route -n default --no-headers -o custom-columns=HOST:.spec.host

 

 

Nginx 서비스 도메인 주소 확인

 

 

 

Nginx 웹 서비스 확인

https://nginx-route-default.apps-crc.testing

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2026/06   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함