apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-test
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-test
  template:
    metadata:
      labels:
        app: nginx-test
    spec:
      containers:
        - name: nginx-test
          image: nginx:1.19
          ports:
            - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
 name: nginx-test
spec:
  type: NodePort
  ports:
    - port: 8080
      targetPort: 80
      nodePort: 38888
  selector:
    app: nginx-test
 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐