# nginx-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  containers:
    - name: nginx
      image: nginx:alpine
      ports:
        - containerPort: 80

# nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx:alpine
          ports:
            - containerPort: 80


# nginx-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  type: NodePort

  

相关文章:

  • 2020-12-20
  • 2021-07-01
  • 2022-12-23
  • 2021-12-12
  • 2021-05-17
  • 2021-12-22
  • 2021-06-24
  • 2022-12-23
猜你喜欢
  • 2021-09-10
  • 2021-08-25
  • 2022-12-23
  • 2021-08-26
  • 2021-11-27
  • 2021-11-13
  • 2021-10-31
相关资源
相似解决方案