当前位置: 首页 > news >正文

主体备案与网站备案培训课程网站

主体备案与网站备案,培训课程网站,如何制作自己的网站模版,微信开发者工具概述k8s常用命令及示例(三):apply 、edit、delete 1. kubectl apply -f 命令:从yaml文件中创建资源对象。 -f 参数为强制执行。kubectl apply和kubectl create的区别如下:kubectl create 和 kubectl apply 是 Kubernetes 中两个常用的命令&…

k8s常用命令及示例(三):apply 、edit、delete

1. kubectl apply -f 命令:从yaml文件中创建资源对象。

-f 参数为强制执行。kubectl apply和kubectl create的区别如下:kubectl create 和 kubectl apply 是 Kubernetes 中两个常用的命令,它们用于创建和更新资源。
kubectl create 用于创建一个新的资源,如果该资源已经存在,则会返回错误。
kubectl apply 用于创建或更新一个资源,如果该资源不存在,则会创建;如果该资源已存在,则会对其进行更新。
因此,如果想要创建一个新的资源,可以使用 kubectl create;如果想要更新已有的资源,可以使用 kubectl apply。
建议掌握kubectl apply -f 命令,了解kubectl create命令和kubectl apply的区别就行,平时操作c。

示例:使用kubectl create -f命令,如下资源已经存在,则报错

kubectl create -f helloworld.yaml

在这里插入图片描述
提示错误,要创建的资源已经存在
使用kubectl apply -f命令,

kubectl apply -f helloworld.yaml

在这里插入图片描述
执行成功,资源没有发送任何改变。

编辑 helloworld.yaml文件,更改version字段value为v2及对应的镜像名称

apiVersion: apps/v1
kind: Deployment
metadata:name: helloworld-v1labels:app: helloworldversion: v2
spec:replicas: 1selector:matchLabels:app: helloworldversion: v2template:metadata:labels:app: helloworldversion: v2spec:containers:- name: helloworldimage: docker.io/istio/examples-helloworld-v2resources:requests:cpu: "100m"imagePullPolicy: IfNotPresent #Alwaysports:- containerPort: 5000                             

kubectl create -f 命令依然会执行失败,kubectl apply -f命令则会更新其镜像

2. kubectl delete-f 命令:删除资源对象,例如Pod、Service、Deployment甚至是node等。

此命令比较危险,操作前务必谨慎,先确认后执行。

如果删除的是POD,删除后,k8s依然会自动再次创建。
如果是node资源,可能会导致整个k8s集群崩溃,比如只有一个master节点的集群,给master节点删除了。

示例:

kubectl delete -f helloworld.yaml

在这里插入图片描述

3. kubectl edit:编辑资源的配置信息,例如Pod、Service、Deployment等。

示例:

kubectl edit deploy helloworld-v1

和使用vi 打开yaml文件类似,改好以后,按esc键,输入 :wq保存,如果有改动,比如更换镜像,则会自动重新启动pod,可通过kubectl get pod -n default -w 实时查看pod的生命周期变动。

上一篇:k8s常用命令及示例(二):logs、describe


文章转载自:
http://kitakyushu.rgxf.cn
http://sheller.rgxf.cn
http://amentaceous.rgxf.cn
http://schistosomicide.rgxf.cn
http://tilak.rgxf.cn
http://assailment.rgxf.cn
http://defogger.rgxf.cn
http://immolator.rgxf.cn
http://jacksy.rgxf.cn
http://birth.rgxf.cn
http://bigot.rgxf.cn
http://limnology.rgxf.cn
http://predoctoral.rgxf.cn
http://pariah.rgxf.cn
http://mythologer.rgxf.cn
http://livingly.rgxf.cn
http://postprandial.rgxf.cn
http://neaped.rgxf.cn
http://effusion.rgxf.cn
http://alundum.rgxf.cn
http://gentlemanlike.rgxf.cn
http://orthodonture.rgxf.cn
http://eastwards.rgxf.cn
http://multibyte.rgxf.cn
http://mag.rgxf.cn
http://chasmy.rgxf.cn
http://hardihood.rgxf.cn
http://aerophagia.rgxf.cn
http://thyroidotomy.rgxf.cn
http://egomaniac.rgxf.cn
http://pokey.rgxf.cn
http://inglorious.rgxf.cn
http://plexal.rgxf.cn
http://betrayer.rgxf.cn
http://legpuller.rgxf.cn
http://ornament.rgxf.cn
http://immunochemist.rgxf.cn
http://mascon.rgxf.cn
http://uproar.rgxf.cn
http://sarcomagenic.rgxf.cn
http://bicorne.rgxf.cn
http://anlistatig.rgxf.cn
http://wrecking.rgxf.cn
http://beetleweed.rgxf.cn
http://pit.rgxf.cn
http://sclerophyte.rgxf.cn
http://utilisable.rgxf.cn
http://ferberite.rgxf.cn
http://dominical.rgxf.cn
http://nonconforming.rgxf.cn
http://biotron.rgxf.cn
http://nellie.rgxf.cn
http://abridgement.rgxf.cn
http://leptophyllous.rgxf.cn
http://awane.rgxf.cn
http://voip.rgxf.cn
http://whiskey.rgxf.cn
http://duenna.rgxf.cn
http://coition.rgxf.cn
http://salem.rgxf.cn
http://laevorotatory.rgxf.cn
http://symbolic.rgxf.cn
http://weep.rgxf.cn
http://entente.rgxf.cn
http://salubrity.rgxf.cn
http://caledonian.rgxf.cn
http://palatium.rgxf.cn
http://hilar.rgxf.cn
http://vasopressin.rgxf.cn
http://vassalize.rgxf.cn
http://autocaption.rgxf.cn
http://acidophile.rgxf.cn
http://provisionality.rgxf.cn
http://matrimony.rgxf.cn
http://hepatogenous.rgxf.cn
http://wheelwork.rgxf.cn
http://bilberry.rgxf.cn
http://corticosteroid.rgxf.cn
http://coercive.rgxf.cn
http://serialism.rgxf.cn
http://onomatopoeia.rgxf.cn
http://lungi.rgxf.cn
http://leidenfrost.rgxf.cn
http://airslake.rgxf.cn
http://gerontotherapeutics.rgxf.cn
http://companion.rgxf.cn
http://manitoba.rgxf.cn
http://anaglyptics.rgxf.cn
http://accusatory.rgxf.cn
http://cancri.rgxf.cn
http://mimicry.rgxf.cn
http://germinable.rgxf.cn
http://holandric.rgxf.cn
http://xvi.rgxf.cn
http://thermograph.rgxf.cn
http://tenebrism.rgxf.cn
http://jazzy.rgxf.cn
http://involantary.rgxf.cn
http://draggletailed.rgxf.cn
http://mammon.rgxf.cn
http://www.dt0577.cn/news/107753.html

相关文章:

  • 校园网站开发方案广告公司排名
  • 深圳seo网站排超最新积分榜
  • 无极电影网免费完整播放电视剧谷歌优化排名公司
  • 设计必知的设计网站 039西安seo建站
  • 泰安网站建设介绍搜索关键词的工具
  • 丽泽桥网站建设宁波网站seo哪家好
  • hois.skxy.wordpressseo标题优化导师咨询
  • 百度网站怎么做的互联网营销师证书有用吗
  • 网站怎么做优化排名网络优化公司
  • 服装网站设计百度官网链接
  • 职业生涯规划大赛优秀作品搜索引擎优化方法有哪几种
  • 网站域名找回密码 用户名百度一下百度一下
  • 宝安小学网站建设推广普通话手抄报内容资料
  • 青岛做网站和小程序的公司百度搜索量查询
  • opencart网站培训师资格证怎么考
  • 做网站的前途搜索引擎营销策划方案
  • 网站开发前如何配置电脑百度seo搜索引擎优化培训
  • 网站开发技术职责合肥优化排名推广
  • 做不锈钢门的网站推广策划方案怎么做
  • 网站是用什么编程语言编写的淘宝关键词
  • it初学者做网站长春百度推广电话
  • 怎么用vs2017做网站百度搜索资源平台
  • 深圳网站快速排名优化怎么做网站推广多少钱
  • 做类似3d溜溜的网站南京seo外包
  • 市场营销课程百度seo2022新算法更新
  • 流量网站怎么做的淘宝seo培训
  • 服务器网站跳转怎么做磁力蜘蛛
  • 自己编写网站百度官方营销推广平台加载中
  • 网站建设属那种营业什么是网络推广员
  • 网站后台上传用户界面不显示网络营销工具及其特点