minikube deployment yaml 파일 생성

2024. 2. 3. 19:02k8s

{namespace}: 원하는 namespace명을 기술

{pod}: 원하는 pod명을 기술

# pod-deployment.yml
-----------------------------------
apiVersion: v1
kind: Namespace
metadata:
  name: {namespace}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {pod}
  namespace: {namespace}
  labels:
    app: {pod}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: {pod}
  template:
    metadata:
      labels:
        app: {pod}
    spec:
      containers:
      - name: {pod}
        image: gcr.io/google-samples/hello-app:1.0
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: {pod}
  namespace: {namespace}
spec:
  selector:
    app: {pod}
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {pod}
  namespace: {namespace}
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - host: pod.test.co.kr
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: {pod}
                port:
                  number: 80
-----------------------------------

# 실행
kubectl apply -f pod-deployment.yaml

'k8s' 카테고리의 다른 글

minikube apiserver curl 호출  (0) 2024.02.18
pod의 상태가 ContainerCreating일 때 조치  (0) 2024.02.03
minikube ingress nginx controller 설치  (0) 2024.01.28
minikube 권한  (0) 2023.05.29
minikube subnet 변경  (0) 2023.04.30