Kubernetes指南
Linux性能优化实战eBPF 核心技术与实战SDN指南个人博客
EN
EN
  • Overview
  • Introduction
    • Kubernetes Introduction
    • Kubernetes Concepts
    • Kubernetes 101
    • Kubernetes 201
    • Kubernetes Cluster
  • Concepts
    • Concepts
    • Architecture
    • Design Principles
    • Components
      • etcd
      • kube-apiserver
      • kube-scheduler
      • kube-controller-manager
      • kubelet
      • kube-proxy
      • kube-dns
      • Federation
      • kubeadm
      • hyperkube
      • kubectl
    • Objects
      • Autoscaling
      • ConfigMap
      • CronJob
      • CustomResourceDefinition
      • DaemonSet
      • Deployment
      • Ingress
      • Job
      • LocalVolume
      • Namespace
      • NetworkPolicy
      • Node
      • PersistentVolume
      • Pod
      • PodPreset
      • ReplicaSet
      • Resource Quota
      • Secret
      • SecurityContext
      • Service
      • ServiceAccount
      • StatefulSet
      • Volume
  • Setup
    • Setup Guidance
    • kubectl Install
    • Single Machine
    • Feature Gates
    • Best Practice
    • Version Support
    • Setup Cluster
      • kubeadm
      • kops
      • Kubespray
      • Azure
      • Windows
      • LinuxKit
      • kubeasz
    • Setup Addons
      • Addon-manager
      • DNS
      • Dashboard
      • Monitoring
      • Logging
      • Metrics
      • GPU
      • Cluster Autoscaler
      • ip-masq-agent
  • Extension
    • API Extension
      • Aggregation
      • CustomResourceDefinition
    • Access Control
      • Authentication
      • RBAC Authz
      • Admission
    • Scheduler Extension
    • Network Plugin
      • CNI
      • Flannel
      • Calico
      • Weave
      • Cilium
      • OVN
      • Contiv
      • SR-IOV
      • Romana
      • OpenContrail
      • Kuryr
    • Container Runtime
      • CRI-tools
      • Frakti
    • Storage Driver
      • CSI
      • FlexVolume
      • glusterfs
    • Network Policy
    • Ingress Controller
      • Ingress + Letsencrypt
      • minikube Ingress
      • Traefik Ingress
      • Keepalived-VIP
    • Cloud Provider
    • Device Plugin
  • Cloud Native Apps
    • Apps Management
      • Patterns
      • Rolling Update
      • Helm
      • Operator
      • Service Mesh
      • Linkerd
      • Linkerd2
    • Istio
      • Deploy
      • Traffic Management
      • Security
      • Policy
      • Metrics
      • Troubleshooting
      • Community
    • Devops
      • Draft
      • Jenkins X
      • Spinnaker
      • Kompose
      • Skaffold
      • Argo
      • Flux GitOps
  • Practices
    • Overview
    • Resource Management
    • Cluster HA
    • Workload HA
    • Debugging
    • Portmap
    • Portforward
    • User Management
    • GPU
    • HugePage
    • Security
    • Audit
    • Backup
    • Cert Rotation
    • Large Cluster
    • Big Data
      • Spark
      • Tensorflow
    • Serverless
  • Troubleshooting
    • Overview
    • Cluster Troubleshooting
    • Pod Troubleshooting
    • Network Troubleshooting
    • PV Troubleshooting
      • AzureDisk
      • AzureFile
    • Windows Troubleshooting
    • Cloud Platform Troubleshooting
      • Azure
    • Troubleshooting Tools
  • Community
    • Development Guide
    • Unit Test and Integration Test
    • Community Contribution
  • Appendix
    • Ecosystem
    • Learning Resources
    • Domestic Mirrors
    • How to Contribute
    • Reference Documents
由 GitBook 提供支持
在本页
  • HugePage
  • Configuration
  • Usage
  • HugePages Unleashed
  • Setting the Stage for HugePages
  • Config Sheet for the Tech-Savvy
  • Entering the HugePages Era
  1. Practices

HugePage

HugePage

HugePage is a new feature introduced in v1.9 (v1.9 Alpha, v1.10 Beta) that enables direct use of HugePages on a Node within containers.

Configuration

  • Enable the feature by setting --feature-gates=HugePages=true

  • Pre-allocate HugePages on the Node with commands like:

mount -t hugetlbfs \
    -o uid=<value>,gid=<value>,mode=<value>,pagesize=<value>,size=<value>,\
    min_size=<value>,nr_inodes=<value> none /mnt/huge

Usage

Here's a sample configuration of a Pod that uses HugePages:

apiVersion: v1
kind: Pod
metadata:
  generateName: hugepages-volume-
spec:
  containers:
  - image: fedora:latest
    command:
    - sleep
    - inf
    name: example
    volumeMounts:
    - mountPath: /hugepages
      name: hugepage
    resources:
      limits:
        hugepages-2Mi: 100Mi
  volumes:
  - name: hugepage
    emptyDir:
      medium: HugePages

Please Note:

  • The request for HugePages and the limit must be the same.

  • HugePage provides Pod-level isolation, but not yet at the container level.

  • EmptyDir volumes based on HugePage can only use the HugePage memory requested.

  • Usage of HugePages can be restricted through ResourceQuota.

  • When obtaining HugePages within a container application using shmget(SHM_HUGETLB), it is essential to configure the user group to match the one in proc/sys/vm/hugetlb_shm_group (securityContext.SupplementalGroups).


HugePages Unleashed

Unlocking the Power of Massive Memory Pages in Containers

Setting the Stage for HugePages

HugePage is a savvy innovation ushered in with v1.9 (Alpha in v1.9, Beta in v1.10), designed to let containers harness the might of Node-level HugePages without a hitch.

Config Sheet for the Tech-Savvy

To get started with HugePages:

  • Flick on the HugePages feature with a simple flag: --feature-gates=HugePages=true

  • Next, line up your HugePages on the Node like ducks in a row with a command akin to:

mount -t hugetlbfs \
    -o uid=<value>,gid=<value>,mode=<value>,pagesize=<value>,size=<value>,\
    min_size=<value>,nr_inodes=<value> none /mnt/huge

Entering the HugePages Era

Craft your Pod with a flair for the huge—here's a blueprint to get you rolling:

apiVersion: v1
kind: Pod
metadata:
  generateName: hugepages-volume-
spec:
  containers:
  - image: fedora:latest
    command:
    - sleep
    - inf
    name: example
    volumeMounts:
    - mountPath: /hugepages
      name: hugepage
    resources:
      limits:
        hugepages-2Mi: 100Mi
  volumes:
  - name: hugepage
    emptyDir:
      medium: HugePages

A Few Pro Tips:

  • When dealing with HugePages, make sure your requests match your limits.

  • Think of HugePages as a Pod-exclusive club—no container can crash this party alone.

  • Your EmptyDir drawers will be custom-fitted just for those HugePages you've asked for.

  • Keep a leash on those HugePages with wise ResourceQuota policies.

  • Want to snag HugePages in your container's app? Sync up with the user group vibe set by proc/sys/vm/hugetlb_shm_group by tweaking securityContext.SupplementalGroups.

上一页GPU下一页Security

最后更新于1年前