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

怎么做网站怎么引入广告挣钱网站建设相关文章

怎么做网站怎么引入广告挣钱,网站建设相关文章,广州白云区最新新闻,网站系统建设申请报告目录 一.Pod结构介绍 1.user container 2.pause 二.Pod工作形式介绍 1.自主式pod 2.控制器管理下的pod 三.对Pod的操作介绍 1.run/apply -f/create -f运行pod 2.get查看pod信息 3.exec操作运行中的pod #xff08;1#xff09;进入运行中的pod #xff08;21进入运行中的pod 2进入pod中的容器 4.logs打印pod日志 5.describe描述pod详细信息用于排错 6.edit编辑运行中的pod 7.cp复制pod内的文件到master 9.delete删除pod 10.扩展使用kubectl命令插件 四.pod的yaml文件配置定义解析 五.Pod对容器的封装 1.对单个容器的封装 2.对多个容器封装并绑定为一个Pod 六.静态Pod管理 1.配置文件方式 2.http方式 一.Pod结构介绍 pod中包含若干个容器大体可以分为两大类 1.user container 用户程序所在容器数量一般可多可少 2.pause 是每一个pod的根容器主要是用来评估pod的健康状态和以根容器设置的IP实现pod内部通信 二.Pod工作形式介绍 主要通过yaml/json文件或kubectl run创建pod但是pod的形式又可以分为两大类 1.自主式pod 通过命令行或run直接定义pod资源这种情况下创建的pod在被删除后就彻底被删除了 2.控制器管理下的pod 控制器管理pod可以保障pod始终维持在指定的数量下运行常见的pod控制器有上篇文章介绍到的deployment控制器还有replicaset、job、cronjob、daemonset等 三.对Pod的操作介绍 1.run/apply -f/create -f运行pod [rootk8s-master pod]# kubectl run mynginx --imagenginx -n myns pod/mynginx created [rootk8s-master pod]# kubectl create -f tomcat.yaml pod/tomcat created [rootk8s-master pod]# kubectl apply -f httpd.yaml pod/httpd created ​ [rootk8s-master pod]# kubectl get pods -n myns NAME     READY   STATUS   RESTARTS   AGE httpd     1/1     Running   0         2m20s mynginx   1/1     Running   0         4m33s tomcat   1/1     Running   0         8s 2.get查看pod信息 1查看所有pod [rootk8s-master ~]# kubectl get pods -A 2查看指定的单个/多个pod [rootk8s-master ~]# kubectl get pod nginx -n myns NAME   READY   STATUS   RESTARTS   AGE nginx   1/1     Running   0         9s ​ [rootk8s-master ~]# kubectl get pod nginx nginx1 -n myns NAME     READY   STATUS   RESTARTS   AGE nginx   1/1     Running   0         97s nginx1   1/1     Running   0         15s 3查看pod同时查看其他类型资源需要具体指定资源类型和名称 [rootk8s-master ~]# kubectl get pod/nginx -n myns node/k8s-node1 NAME       READY   STATUS   RESTARTS   AGE pod/nginx   1/1     Running   0         104s ​ NAME             STATUS   ROLES   AGE   VERSION node/k8s-node1   Ready   none   3m6s   v1.28.2 4同时应用多个关于pod的yaml文件时添加多个-f参数即可 5列出在某个节点上运行的pod [rootk8s-master ~]# kubectl get pods --field-selectorspec.nodeNamek8s-node1 6-w实时查看pod信息 [rootk8s-master ~]# kubectl get pod -w nginx -n myns NAME   READY   STATUS   RESTARTS   AGE nginx   1/1     Running   0         4h16m [rootk8s-master ~]# 3.exec操作运行中的pod 1进入运行中的pod [rootk8s-master ~]# kubectl exec -it nginx -n myns -- /bin/bash rootnginx:/# ls bin   docker-entrypoint.d   home   lib64   mnt root srv usr boot docker-entrypoint.sh lib   libx32 opt run   sys var dev   etc   lib32 media   proc sbin tmp ​ #不进入但执行命令 [rootk8s-master ~]# kubectl exec -it nginx -n myns -- ls bin   docker-entrypoint.d   home   lib64   mnt root srv usr boot docker-entrypoint.sh lib   libx32 opt run   sys var dev   etc   lib32 media   proc sbin tmp 2进入pod中的容器 [rootk8s-master ~]# kubectl exec -it nginx -c xxx -n myns -- /bin/bash #-c后指定容器名称 4.logs打印pod日志 [rootk8s-master ~]# kubectl logs nginx -n myns /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh /docker-entrypoint.sh: Configuration complete; ready for start up 2023/10/31 09:08:21 [notice] 1#1: using the epoll event method 2023/10/31 09:08:21 [notice] 1#1: nginx/1.25.3 2023/10/31 09:08:21 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14) 2023/10/31 09:08:21 [notice] 1#1: OS: Linux 3.10.0-1160.el7.x86_64 2023/10/31 09:08:21 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 2023/10/31 09:08:21 [notice] 1#1: start worker processes 2023/10/31 09:08:21 [notice] 1#1: start worker process 29 2023/10/31 09:08:21 [notice] 1#1: start worker process 30 2023/10/31 09:08:21 [notice] 1#1: start worker process 31 2023/10/31 09:08:21 [notice] 1#1: start worker process 32[rootk8s-master ~]# kubectl logs nginx -n myns -f #加-f参数持续监控 5.describe描述pod详细信息用于排错 [rootk8s-master ~]# kubectl describe pod nginx -n myns 6.edit编辑运行中的pod 更改完后需要w/wq保存 [rootk8s-master ~]# kubectl edit pod nginx -n myns 7.cp复制pod内的文件到master [rootk8s-master ~]# kubectl exec -it nginx -n myns -- cat /etc/hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.244.36.65 nginx[rootk8s-master ~]# kubectl cp nginx:etc/hosts -n myns /root/myhosts #“:”后不需要指示“/”号master的目标路径需要是一个文件而不是一个目录此处的/root/myhosts [rootk8s-master ~]# cat myhosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.244.36.65 nginx 9.delete删除pod 1通过delete pod进行删除 [rootk8s-master pod]# kubectl get pod mynginx -n myns --show-labels NAME READY STATUS RESTARTS AGE LABELS mynginx 1/1 Running 0 37m runnginx,usersulibao [rootk8s-master pod]# kubectl delete pod mynginx -n myns pod mynginx deleted 2若是通过文件创建的pod可以通过delete -f进行删除 [rootk8s-master pod]# kubectl delete -f nginx.yaml pod mynginx deleted 3若是拥有标签的pod可以通过匹配标签进行删除 [rootk8s-master pod]# kubectl delete pods -l runnginx -n myns pod mynginx deleted 10.扩展使用kubectl命令插件 1必须是“kubectl-自定义名称”格式命名 [rootk8s-master ~]# vim /usr/local/bin/kubectl-pwd #放在/usr/local/bin下 [rootk8s-master ~]# cat /usr/local/bin/kubectl-pwd #!/bin/bashpwd[rootk8s-master ~]# chmod x /usr/local/bin/kubectl-pwd #一定要加上执行权限 [rootk8s-master ~]# kubectl pwd /root [rootk8s-master pod]# kubectl pwd pod httpd -n myns /root/pod 2kubectl plugin list查看已安装插件列表 [rootk8s-master ~]# kubectl plugin list /usr/local/bin/kubectl-pwd 3rm直接删除该文件即可卸载插件 [rootk8s-master ~]# rm -f /usr/local/bin/kubectl-pwd [rootk8s-master ~]# kubectl plugin list error: unable to find any kubectl plugins in your PATH 四.pod的yaml文件配置定义解析 [rootk8s-master ~]# kubectl explain pod.spec #可以以此形式来一层一层获取可配置项apiVersion: v1 #必选项版本号如V1 kind: Pod #必选项资源类型pod等 metadata: #必选项元数据部分name: xxx #Pod名称namespace: xxx #Pod所属的命名空间,默认为defaultlabels: #自定义标签列表- name: xxx #自定义标签内容 spec: #必选项Pod中容器的详细定义containers: #必选项Pod中容器列表- name: xxx #必选项容器名称image: xxx #必选项容器的镜像名称imagePullPolicy: [ Always|Never|IfNotPresent ] #获取镜像的策略tag为latest默认alwaystag为具体版本号默认IfNotPresent。always表示每次都尝试重新拉取镜像ifNotPresent表示如果本地有那个镜像就使用本地的不存在时才拉取Nerver表示仅使用本地有的镜像绝不拉取本地没有时报错command: [xxx] #容器的启动命令列表如不指定则使用打包时使用的启动命令args: [xxx] #容器的启动命令给定参数列表workingDir: xxx #容器的工作目录volumeMounts: #挂载到容器内部的存储卷配置- name: xxx#引用pod定义的共享存储卷的名称需用volumes[]部分定义的的卷名mountPath: xxx #存储卷在容器内mount的绝对路径应少于512字符readOnly: xxx#布尔值是否为只读模式ports: #需要暴露的端口库号列表- name: xxx#端口的名称containerPort: xxx #容器需要监听的端口号hostPort: xxx#容器所在主机需要监听的端口号默认与Container相同protocol: xxx #端口协议支持TCP和UDP默认TCPenv: #容器运行前需设置的环境变量列表- name: xxx #环境变量名称value: xxx #环境变量的值resources: #资源限制和请求的设置limits: #资源限制的设置cpu: xxx #cpu的限制单位为core数将用于docker run --cpu-shares参数memory: xxx #内存限制单位可以为Mib/Gib将用于docker run --memory参数requests: #资源请求的设置cpu: xxx #cpu请求容器启动的初始可用数量memory: xxx #内存请求,容器启动的初始可用数量lifecycle: #生命周期钩子postStart: #容器启动后立即执行此钩子,如果执行失败,会根据重启策略进行重启preStop: #容器终止前执行此钩子,无论结果如何,容器都会终止livenessProbe: #对Pod内各容器健康检查的设置当探测无响应几次后将自动重启该容器exec: #对Pod容器内检查方式设置为exec方式command: [xxx] #exec方式需要制定的命令或脚本httpGet: #对Pod内个容器健康检查方法设置为HttpGet需要制定Path、portpath: xxxport: xxxhost: xxxscheme: xxxHttpHeaders:- name: xxxvalue: xxxtcpSocket: #对Pod内个容器健康检查方式设置为tcpSocket方式port: numberinitialDelaySeconds: 0 #容器启动完成后首次探测的时间单位为秒timeoutSeconds: 0 #对容器健康检查探测等待响应的超时时间单位秒默认1秒periodSeconds: 0 #对容器监控检查的定期探测时间设置单位秒默认10秒一次successThreshold: 0failureThreshold: 0securityContext:privileged: false restartPolicy: [Always | Never | OnFailure] #Pod的重启策略 nodeName: xxx #设置NodeName表示将该Pod调度到指定到名称的node节点上 nodeSelector: xxx #设置NodeSelector表示将该Pod调度到包含这个label的node上 imagePullSecrets: #Pull镜像时使用的secret名称以keysecretkey格式指定- name: xxx hostNetwork: false #是否使用主机网络模式默认为false如果设置为true表示使用宿主机网络 volumes: #在该pod上定义共享存储卷列表- name: string #共享存储卷名称 volumes类型有很多种emptyDir: {} #类型为emtyDir的存储卷与Pod同生命周期的一个临时目录。为空值hostPath: xxx #类型为hostPath的存储卷表示挂载Pod所在宿主机的目录path: xxx #Pod所在宿主机的目录将被用于同期中mount的目录secret: #类型为secret的存储卷挂载集群与定义的secret对象到容器内部scretname: xxxitems:- key: xxxpath: xxxconfigMap: #类型为configMap的存储卷挂载预定义的configMap对象到容器内部name: xxxitems:- key: xxxpath: xxx 五.Pod对容器的封装 1.对单个容器的封装 apiVersion: v1 kind: Pod metadata:name: httpdlabels:run: httpdnamespace: myns spec:containers:- name: httpdimage: httpdports:- containerPort: 80 2.对多个容器封装并绑定为一个Pod apiVersion: v1 kind: Pod metadata:name: two-containersnamespace: mynslabels:name: tc spec:containers:- name: first-containerimage: nginxports:- containerPort: 80- name: second-containerimage: busyboxcommand: [/bin/sh, -c, while true; do echo Hello from the second container /shared-data/index.html; sleep 10; done]volumeMounts:- name: shared-datamountPath: /shared-dataports:- containerPort: 8080volumes:- name: shared-dataemptyDir: {} 六.静态Pod管理 1.配置文件方式 1首先找到你的kubelet的service位置 [rootk8s-master ~]# rpm -ql kubelet /etc/kubernetes/manifests /etc/sysconfig/kubelet /usr/bin/kubelet /usr/lib/systemd/system/kubelet.service # 2到该目录下查看是否有conf文件 [rootk8s-master ~]# ll /usr/lib/systemd/system/kubelet.service.d/ total 4 -rw-r--r-- 1 root root 1009 Nov 11 11:03 10-kubeadm.conf [rootk8s-master ~]# vim /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf 3旧版本应该会有我的Kubernetes v1.28.2没有行命令手动添加 EnvironmentKUBELET_SYSTEM_PODS_ARGS--pod-manifest-path/etc/kubernetes/manifests --allow-privilegedtrue 这行命令中指定了mainifest-path为/etc/kubernetes/manifests那么我们在这个目录中去创建一个pod的yaml文件重启kubelet服务不需要apply此文件就会自动创建该pod # Note: This dropin only works with kubeadm and kubelet v1.11 [Service] EnvironmentKUBELET_KUBECONFIG_ARGS--bootstrap-kubeconfig/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig/etc/kubernetes/kubelet.conf EnvironmentKUBELET_CONFIG_ARGS--config/var/lib/kubelet/config.yaml EnvironmentKUBELET_SYSTEM_PODS_ARGS--pod-manifest-path/etc/kubernetes/manifests --allow-privilegedtrue # This is a file that kubeadm init and kubeadm join generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically EnvironmentFile-/var/lib/kubelet/kubeadm-flags.env # This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use # the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file. EnvironmentFile-/etc/sysconfig/kubelet ExecStart ExecStart/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS 4验证是否成功 [rootk8s-master ~]# cat /etc/kubernetes/manifests/static.yaml apiVersion: v1 kind: Pod metadata:name: mywebnamespace: mynslabels:name: my-web spec:containers:- name: myhttpdimage: httpdports:- name: webcontainerPort: 80[rootk8s-master manifests]# systemctl daemon-reload #重载并重启 [rootk8s-master manifests]# systemctl restart kubelet.service [rootk8s-master ~]# kubectl get pods -n myns NAME READY STATUS RESTARTS AGE myweb-k8s-master 1/1 Running 0 2m41s 5删除时注意事项 直接删除该静态pod只会让其呈现为pending状态需要删除该yaml文件 [rootk8s-master ~]# kubectl delete pod myweb-k8s-master -n myns pod myweb-k8s-master deleted [rootk8s-master ~]# kubectl get pods -n myns NAME READY STATUS RESTARTS AGE myweb-k8s-master 0/1 Pending 0 3s [rootk8s-master ~]# rm -rf /etc/kubernetes/manifests/static.yaml [rootk8s-master ~]# kubectl get pods -n myns NAME READY STATUS RESTARTS AGE myweb-k8s-master 0/1 Completed 0 80s [rootk8s-master ~]# kubectl get pods -n myns No resources found in myns namespace. 2.http方式 使用“--manifest-url”参数来指定1url地址不常用的方式但是可以配合第一种方式使用就cd到启动配置的mainifest-path下使用wget把url内的配置文件下载下来即立即创建配置文件有误的情况不会创建 [rootk8s-master manifests]# wget http://47.115.228.189/web.yaml --2023-11-11 17:10:02-- http://47.115.228.189/web.yaml Connecting to 47.115.228.189:80... connected. HTTP request sent, awaiting response... 200 OK Length: 185 [application/octet-stream] Saving to: ‘web.yaml’100%[] 185 --.-K/s in 0s 2023-11-11 17:10:02 (50.0 MB/s) - ‘web.yaml’ saved [185/185][rootk8s-master manifests]# kubectl get pods -n myns NAME READY STATUS RESTARTS AGE myweb-k8s-master 0/1 ContainerCreating 0 7s [rootk8s-master manifests]# kubectl get pods -n myns NAME READY STATUS RESTARTS AGE myweb-k8s-master 1/1 Running 0 2m45s
http://www.tj-hxxt.cn/news/233489.html

相关文章:

  • 建设一个购物网站多少钱深圳网站建设top028
  • 华为云怎么做网站中国龙城室内设计联盟
  • 网站后台图片编辑器网页设计代码动漫
  • 智联招聘网站怎么做微招聘信息中铁建设中南公司官方网站
  • 手机集团网站建设旅游网站模块报价
  • 濮阳住房和城乡建设部网站公司网站seo公司
  • 专业网站建设微信官网开发云南省建设厅一级建造师网站
  • 山西省建设局网站jsp网站首页怎么做
  • wix如何做网站python做网站 不适合
  • 商标注册号是什么seo推广方法
  • 网站建设文化咨询wordpress 汉化 插件怎么用
  • 模版网站利于优化photoshop网站设计
  • 沈阳沈河区网站建设西安网站制作公司怎么选
  • 梧州网站建设费用推广公司app主要做什么
  • 江西中耀建设集团有限公司网站船员专用网站开发建议
  • wordpress网站排行东莞网站建设服务有什么用
  • 做美食直播哪个网站好网站运营工作计划
  • 网站建设与设计教程视频教程会计
  • 厦门市建设工程质监站网站泰安有什么互联网公司
  • 云南集优科技网站移动端网站建设的意义
  • 用安卓做网站企业网站的常见服务是什么
  • 广东广州电脑个人建站空间设计和室内设计的区别
  • 广州网站建设快速排名google高级搜索
  • 杭州设计网站的公司哪家好百度应用
  • 网站更新了文章看不到店面招牌设计效果图大全
  • 自己在公司上班做网站宣传 侵权吗手机网站内容规划
  • 做网站的报价方案阿里云万网网站制作
  • 用什么自己做网站吗论坛建站哪个比较好
  • 网站建站设计电商网站建设功能
  • 任县网站建设公司网页设计策划书ppt