欢迎关注我的公众号:

 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:

istio多集群探秘,部署了50次多集群后我得出的结论

istio多集群链路追踪,附实操视频

istio防故障利器,你知道几个,istio新手不要读,太难!

istio业务权限控制,原来可以这么玩

istio实现非侵入压缩,微服务之间如何实现压缩

不懂envoyfilter也敢说精通istio系列-http-rbac-不要只会用AuthorizationPolicy配置权限

不懂envoyfilter也敢说精通istio系列-02-http-corsFilter-不要只会vs

不懂envoyfilter也敢说精通istio系列-03-http-csrf filter-再也不用再代码里写csrf逻辑了

不懂envoyfilter也敢说精通istio系列http-jwt_authn-不要只会RequestAuthorization

不懂envoyfilter也敢说精通istio系列-05-fault-filter-故障注入不止是vs

不懂envoyfilter也敢说精通istio系列-06-http-match-配置路由不只是vs

不懂envoyfilter也敢说精通istio系列-07-负载均衡配置不止是dr

不懂envoyfilter也敢说精通istio系列-08-连接池和断路器

不懂envoyfilter也敢说精通istio系列-09-http-route filter

不懂envoyfilter也敢说精通istio系列-network filter-redis proxy

不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager

不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册

 

————————————————

资源限制:

kubernetes提供了两种资源限制的方式:ResourceQuota LimitRange

其中ResourceQuota 是针对namespace做的资源限制,而LimitRange是针对namespace中的每个组件做的资源限制。

ResourceQuota:

配置一个namespace可以使用的资源量

资源配额能够对计算资源CPU和内存)、存储资源、以及对资源对象的数量进行管理。

常用资源类型:

计算资源配额

存储资源配额

对象数量配额

计算资源配额:

存储资源配额:

requests.storage

persistentvolumeclaims

<storage-class-name>.storageclass.storage.k8s.io/requests.storage

<storage-class-name>.storageclass.storage.k8s.io/persistentvolumeclaims

requests.ephemeral-storage

limits.ephemeral-storage

对象数量配额:

Quota Scopes:

示例:

[root@master01 compute-resources]# cat compute-resources.yaml 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: compute-resources
spec:
  hard:
    requests.cpu: "0.1"
    requests.memory: 100Mi
    limits.cpu: "0.2"
    limits.memory: 200Mi
[root@master01 storage]# cat storage.yaml 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: storage-resources
spec:
  hard:
    requests.storage: 200Mi
    requests.ephemeral-storage: 1Mi
    limits.ephemeral-storage: 1Mi
    nfs-sc.storageclass.storage.k8s.io/requests.storage: 100Mi
    nfs-sc.storageclass.storage.k8s.io/persistentvolumeclaims: 1
    persistentvolumeclaims: 2
[root@master01 object-counts]# cat object-counts.yaml 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: object-counts
spec:
  hard:
    persistentvolumeclaims: 1
    services.loadbalancers: 1
    services.nodeports: 1
    configmaps: 1
    pods: 1
    resourcequotas: 1
    services: 1
    secrets: 1
[root@master01 best-effort]# cat best-effort.yaml 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: best-effort
spec:
  hard:
    pods: "2"
  scopes:
  - BestEffort
[root@master01 not-best-effort]# cat not-best-effort.yaml 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: not-best-effort
spec:
  hard:
    pods: "2"
    requests.cpu: "0.1"
    requests.memory: 100Mi
    limits.cpu: "0.2"
    limits.memory: 200Mi
  scopes:
  - NotBestEffort
[root@master01 termination]# cat termination.yaml 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: termination
spec:
  hard:
    requests.cpu: "0.1"
    requests.memory: 100Mi
    limits.cpu: "0.2"
    limits.memory: 200Mi
  scopes:
  - Terminating
[root@master01 nottermination]# cat notterminating.yaml 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: termination
spec:
  hard:
    requests.cpu: "0.1"
    requests.memory: 100Mi
    limits.cpu: "0.2"
    limits.memory: 200Mi
  scopes:
  - NotTerminating
[root@master01 prioity-class]# cat prioity-class.yaml 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: priority-high
spec:
    hard:
      cpu: "0.1"
      memory: 100Mi
      pods: "2"
    scopeSelector:
      matchExpressions:
      - operator : In
        scopeName: PriorityClass
        values: ["high"]

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐