|NO.Z.00232|——————————|^^ 失败 ^^|——|KuberNetes&细粒度权限控制.V16|——|准入控制.v02|PodPreset实验|

一、QoS
### --- QoS

~~~     QoS:Quality of Service,服务质量。
~~~     Guaranteed:k8s的最高的服务质量,也就是CPU内存的Request和Limit的值一样。
~~~     Burstable:CPU内存的request有配置,但是值不一样
~~~     BestEffort:没有配置Request和Limit
~~~     OOM,先删除服务质量为BestEffort,然后在删除Burstable,Guaranteed最后被删除。
~~~     16核—request=limit,1 一个16核的宿主机只能运行16个容器。
~~~     Node上面的CPU,利用率其实很低。100m=100m
~~~     3G 3.5G
二、PodPreset(实验失败,待实验
### --- PodPreset(实验失败,待实验)

~~~     # 请注意: k8s 1.20版本已经删除PodPreset功能,低于1.20版本正常使用
~~~     PodPreset:Pod的一些预配置。比如添加一些变量、挂载卷、配置容器的时间、字符集等。
~~~     开启PodPreset的方法:https://kubernetes.io/docs/concepts/workloads/pods/podpreset/
~~~     使用PodPreset的文档:https://kubernetes.io/docs/tasks/inject-data-application/podpreset/
三、配置podPreset
### --- 配置PodPreset:(所有master节点)

[root@k8s-master01 ~]# vim /usr/lib/systemd/system/kube-apiserver.service
      --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,ResourceQuota,PodPreset \
# 这行末尾添加参数: ,PodPreset      
      --feature-gates=EphemeralContainers=true \                // 此行下添加参数
      --runtime-config=settings.k8s.io/v1alpha1=true \          // 添加此行内容
      --requestheader-extra-headers-prefix=X-Remote-Extra-  \   // 此行上添加参数
[root@k8s-master01 ~]# systemctl daemon-reload      
[root@k8s-master01 ~]# systemctl restart kube-apiserver      
四、是有namespace隔离。同一个Volume不能挂载到不同的路径
### --- 是有namespace隔离。同一个Volume不能挂载到不同的路径
~~~     # 忽略预配置:podpreset.admission.kubernetes.io/exclude: "true"

apiVersion: settings.k8s.io/v1alpha1
kind: PodPreset
metadata:
  name: time
spec:
#  selector:
#    matchLabels:
#      role: frontend
  env:
    - name: LANG
      value: "C.UTF-8"
  volumeMounts:
    - mountPath: /usr/share/zoneinfo/Asia/Shanghai
      name: tz-config
      readOnly: true
    - mountPath: /etc/localtime
      name: tz-config2
      readOnly: true
    - mountPath: /etc/timezone
      name: timezone
      readOnly: true
  volumes:
    - name: tz-config2
      hostPath:
       path: /usr/share/zoneinfo/Asia/Shanghai
    - name: tz-config
      hostPath:
       path: /usr/share/zoneinfo/Asia/Shanghai
    - name: timezone
      hostPath:
       path: /etc/timezone

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(10)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示