首先是deployment:

 

apiVersion: apps/v1
kind: Deployment
metadata:
  name: webapp1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: webapp1
  template:
    metadata:
      labels:
        app: webapp1
    spec:
      containers:
      - name: webapp1
        image: katacoda/docker-http-server:latest
        ports:
        - containerPort: 80      

 

部署命令:kubectl create -f deployment.yaml

 

第二是个 nodeport方式的service

apiVersion: v1
kind: Service
metadata:
  name: webapp1-svc
  labels:
    app: webapp1
spec:
  type: NodePort
  ports:
  - port: 80
    nodePort: 30080
  selector:
    app: webapp1

  

相关文章:

  • 2021-10-25
  • 2023-02-08
  • 2022-02-27
  • 2022-12-23
  • 2021-11-04
  • 2021-09-27
  • 2021-09-30
猜你喜欢
  • 2021-12-15
  • 2021-12-22
  • 2021-12-20
  • 2022-01-15
  • 2022-12-23
  • 2021-10-22
相关资源
相似解决方案