Kubernetes基础:Deployment

来自AI助手的总结
介绍了用YAML创建、查看和删除Nginx Deployment的流程
Kubernetes基础:Deployment

一、创建YAML文件

$ vim ng-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myng
  name: ng-deploy
  namespace: aming
spec:
  replicas: 2 ##副本数
  selector:
    matchLabels:
      app: myng
  template:
    metadata:
      labels:
        app: myng
    spec:
      containers:
        - name: myng
          image: nginx:1.21.6
          ports:
          - name: myng-port
            containerPort: 80

二、使用YAML创建deploy

$ k apply -f ng-deploy.yaml

三、查看

$ k get deploy,po -n aming

四、查看pod分配到哪个节点上

$ k get po -o wide

五、恢复

$ k delete -f ng-deploy.yaml
© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容