본문 바로가기

kubernetes

nginx service LB로 올리기

apiVersion: v1
kind: Namespace
metadata:
  name: dev-migam
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: nginx
  namespace: dev-migam
  
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: nginx
  replicas: 3 # tells deployment to run 1 pods matching the template
  template: # create pods using pod definition in this template
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx
  namespace: dev-migam
  labels:
    app: nginx
spec:
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx
  type: LoadBalancer

'kubernetes' 카테고리의 다른 글

pod packet capture  (0) 2022.09.26
도대체 service라는 녀석은 뭘까?  (0) 2022.09.25
Ubuntu 22.04에 k3s설치하기  (0) 2022.09.08
왜? pod에 한개의 VSCode만 attach되는 거여?  (0) 2022.07.20
k3s master 설치 on CentOS  (0) 2022.03.21