记录一个标准的k8s deployment

首先是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

  

posted @ 2021-03-08 15:22  忙碌在路上  阅读(102)  评论(0编辑  收藏  举报