<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # Objects 以下列舉的內容都是 kubernetes 中的 Object,這些對象都可以在 yaml 文件中作為一種 API 類型來配置。 - Pod - Node - Namespace - Service - Volume - PersistentVolume - Deployment - Secret - StatefulSet - DaemonSet - ServiceAccount - ReplicationController - ReplicaSet - Job - CronJob - SecurityContext - ResourceQuota - LimitRange - HorizontalPodAutoscaling - Ingress - ConfigMap - Label - CustomResourceDefinition - Role - ClusterRole 我將它們簡單的分類為以下幾種資源對象: | 類別 | 名稱 | | :------- | ------------------------------------------------------------ | | 資源對象 | Pod、ReplicaSet、ReplicationController、Deployment、StatefulSet、DaemonSet、Job、CronJob、HorizontalPodAutoscaling、Node、Namespace、Service、Ingress、Label、CustomResourceDefinition | | 存儲對象 | Volume、PersistentVolume、Secret、ConfigMap | | 策略對象 | SecurityContext、ResourceQuota、LimitRange | | 身份對象 | ServiceAccount、Role、ClusterRole | ## 理解 kubernetes 中的對象 在 Kubernetes 系統中,*Kubernetes 對象* 是持久化的條目。Kubernetes 使用這些條目去表示整個集群的狀態。特別地,它們描述了如下信息: - 什么容器化應用在運行(以及在哪個 Node 上) - 可以被應用使用的資源 - 關于應用如何表現的策略,比如重啟策略、升級策略,以及容錯策略 Kubernetes 對象是 “目標性記錄” —— 一旦創建對象,Kubernetes 系統將持續工作以確保對象存在。通過創建對象,可以有效地告知 Kubernetes 系統,所需要的集群工作負載看起來是什么樣子的,這就是 Kubernetes 集群的 **期望狀態**。 與 Kubernetes 對象工作 —— 是否創建、修改,或者刪除 —— 需要使用 [Kubernetes API](https://git.k8s.io/community/contributors/devel/api-conventions.md)。當使用 `kubectl` 命令行接口時,比如,CLI 會使用必要的 Kubernetes API 調用,也可以在程序中直接使用 Kubernetes API。為了實現該目標,Kubernetes 當前提供了一個 `golang` [客戶端庫](https://github.com/kubernetes/client-go) ,其它語言庫(例如[Python](https://github.com/kubernetes-incubator/client-python))也正在開發中。 ### 對象 Spec 與狀態 每個 Kubernetes 對象包含兩個嵌套的對象字段,它們負責管理對象的配置:對象 *spec* 和 對象 *status*。*spec* 必須提供,它描述了對象的 *期望狀態*—— 希望對象所具有的特征。*status* 描述了對象的 *實際狀態*,它是由 Kubernetes 系統提供和更新。在任何時刻,Kubernetes 控制平面一直處于活躍狀態,管理著對象的實際狀態以與我們所期望的狀態相匹配。 例如,Kubernetes Deployment 對象能夠表示運行在集群中的應用。當創建 Deployment 時,可能需要設置 Deployment 的 spec,以指定該應用需要有 3 個副本在運行。Kubernetes 系統讀取 Deployment spec,啟動我們所期望的該應用的 3 個實例 —— 更新狀態以與 spec 相匹配。如果那些實例中有失敗的(一種狀態變更),Kubernetes 系統通過修正來響應 spec 和狀態之間的不一致 —— 這種情況,啟動一個新的實例來替換。 關于對象 spec、status 和 metadata 更多信息,查看 [Kubernetes API Conventions]( https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md)。 ### 描述 Kubernetes 對象 當創建 Kubernetes 對象時,必須提供對象的 spec,用來描述該對象的期望狀態,以及關于對象的一些基本信息(例如,名稱)。當使用 Kubernetes API 創建對象時(或者直接創建,或者基于`kubectl`),API 請求必須在請求體中包含 JSON 格式的信息。**更常用的是,需要在 .yaml 文件中為 kubectl 提供這些信息**。 `kubectl` 在執行 API 請求時,將這些信息轉換成 JSON 格式。 這里有一個 `.yaml` 示例文件,展示了 Kubernetes Deployment 的必需字段和對象 spec: ```yaml apiVersion: apps/v1beta1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 3 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.7.9 ports: - containerPort: 80 ``` 一種創建 Deployment 的方式,類似上面使用 `.yaml` 文件,是使用 `kubectl` 命令行接口(CLI)中的 `kubectl create` 命令,傳遞 `.yaml` 作為參數。下面是一個示例: ```bash $ kubectl create -f docs/user-guide/nginx-deployment.yaml --record ``` 輸出類似如下這樣: ```bash deployment "nginx-deployment" created ``` ### 必需字段 在想要創建的 Kubernetes 對象對應的 `.yaml` 文件中,需要配置如下的字段: - `apiVersion` - 創建該對象所使用的 Kubernetes API 的版本 - `kind` - 想要創建的對象的類型 - `metadata` - 幫助識別對象唯一性的數據,包括一個 `name` 字符串、UID 和可選的 `namespace` 也需要提供對象的 `spec` 字段。對象 `spec` 的精確格式對每個 Kubernetes 對象來說是不同的,包含了特定于該對象的嵌套字段。[Kubernetes API 參考](https://kubernetes.io/docs/api/)能夠幫助我們找到任何我們想創建的對象的 spec 格式。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看