部署
apiVersion: apps/v1
import "k8s.io/api/apps/v1"
部署
部署啟用 Pod 和 ReplicaSet 的宣告式更新。
apiVersion: apps/v1
kind: Deployment
metadata (ObjectMeta)
標準物件的中繼資料。 更多資訊: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec (DeploymentSpec)
部署的所需行為規格。
status (DeploymentStatus)
部署最近觀察到的狀態。
DeploymentSpec
DeploymentSpec 是部署的所需行為規格。
selector (LabelSelector), 必要
Pod 的標籤選擇器。 現有的 ReplicaSet,其 Pod 由此選取,將會是受此部署影響的對象。 它必須與 Pod 範本的標籤相符。
template (PodTemplateSpec), 必要
範本描述將建立的 Pod。 唯一允許的 template.spec.restartPolicy 值為 "Always"。
replicas (int32)
所需的 Pod 數量。 這是一個指標,用於區分明確的零和未指定。 預設值為 1。
minReadySeconds (int32)
新建立的 Pod 應在沒有任何容器崩潰的情況下準備就緒的最短秒數,以便將其視為可用。 預設值為 0(Pod 將在準備就緒後立即被視為可用)
strategy (DeploymentStrategy)
修補策略:retainKeys
用於將現有 Pod 替換為新 Pod 的部署策略。
DeploymentStrategy 描述如何將現有 Pod 替換為新 Pod。
strategy.type (string)
部署類型。 可以是 "Recreate" 或 "RollingUpdate"。 預設值為 RollingUpdate。
strategy.rollingUpdate (RollingUpdateDeployment)
滾動更新組態參數。 僅在 DeploymentStrategyType = RollingUpdate 時存在。
strategy.rollingUpdate.maxSurge (IntOrString)
可以排程超出所需 Pod 數量的最大 Pod 數量。 值可以是絕對數字(例如:5)或所需 Pod 的百分比(例如:10%)。 如果 MaxUnavailable 為 0,則這不能為 0。 絕對數字是透過將百分比向上捨入來計算。 預設值為 25%。 範例:當此值設定為 30% 時,新的 ReplicaSet 可以在滾動更新開始時立即擴展,以便舊 Pod 和新 Pod 的總數不超過所需 Pod 的 130%。 一旦舊 Pod 被終止,新的 ReplicaSet 可以進一步擴展,確保在更新期間任何時間運行的 Pod 總數最多為所需 Pod 的 130%。
IntOrString 是一種可以容納 int32 或字串的類型。 當在 JSON 或 YAML 編組和解組中使用時,它會產生或消耗內部類型。 這允許您擁有,例如,可以接受名稱或數字的 JSON 欄位。
strategy.rollingUpdate.maxUnavailable (IntOrString)
更新期間可能無法使用的 Pod 數量上限。值可以是絕對數字(例如:5)或所需 Pod 的百分比(例如:10%)。絕對數字由百分比向下捨入計算而得。如果 MaxSurge 為 0,則此值不能為 0。預設值為 25%。範例:當此值設定為 30% 時,當滾動更新開始時,舊的 ReplicaSet 可以立即縮減至所需 Pod 的 70%。一旦新的 Pod 準備就緒,舊的 ReplicaSet 可以進一步縮減,然後擴增新的 ReplicaSet,確保在更新期間所有時間可用的 Pod 總數至少為所需 Pod 的 70%。
IntOrString 是一種可以容納 int32 或字串的類型。 當在 JSON 或 YAML 編組和解組中使用時,它會產生或消耗內部類型。 這允許您擁有,例如,可以接受名稱或數字的 JSON 欄位。
revisionHistoryLimit (int32)
為了允許回滾而保留的舊 ReplicaSet 數量。這是一個指標,用於區分明確的零值和未指定。預設值為 10。
progressDeadlineSeconds (int32)
部署被視為失敗之前,部署取得進展的最長秒數。部署控制器將繼續處理失敗的部署,並且在部署狀態中將會顯示具有 ProgressDeadlineExceeded 原因的狀況。請注意,在部署暫停期間不會估計進度。預設值為 600 秒。
paused (boolean)
表示部署已暫停。
DeploymentStatus
DeploymentStatus 是最近觀察到的部署狀態。
replicas (int32)
此部署所針對的非終止 Pod 總數(其標籤與選擇器匹配)。
availableReplicas (int32)
此部署所針對的可用 Pod 總數(至少準備就緒 minReadySeconds)。
readyReplicas (int32)
readyReplicas 是此 Deployment 所針對的、具有 Ready Condition 的 Pod 數量。
unavailableReplicas (int32)
此部署所針對的不可用 Pod 總數。這是部署達到 100% 可用容量仍然需要的 Pod 總數。它們可能是正在執行但尚未可用的 Pod,或仍然尚未建立的 Pod。
updatedReplicas (int32)
此部署所針對的、具有所需範本規格的非終止 Pod 總數。
collisionCount (int32)
Deployment 的雜湊衝突計數。當部署控制器需要為最新的 ReplicaSet 建立名稱時,會使用此欄位作為衝突避免機制。
conditions ([]DeploymentCondition)
修補策略:在鍵
type
上合併Map:在合併期間,鍵 type 上的唯一值將被保留
表示部署目前狀態的最新可用觀察結果。
DeploymentCondition 描述部署在特定時間點的狀態。
conditions.status (string), 必填
狀況的狀態,為 True、False、Unknown 之一。
conditions.type (string), 必填
部署狀況的類型。
conditions.lastTransitionTime (Time)
狀況上次從一個狀態轉換到另一個狀態的時間。
Time 是 time.Time 的包裝器,支援正確地封送處理為 YAML 和 JSON。為 time 套件提供的許多工廠方法提供了包裝器。
conditions.lastUpdateTime (Time)
上次更新此狀況的時間。
Time 是 time.Time 的包裝器,支援正確地封送處理為 YAML 和 JSON。為 time 套件提供的許多工廠方法提供了包裝器。
conditions.message (string)
人類可讀的消息,指示有關轉換的詳細資訊。
conditions.reason (string)
狀況上次轉換的原因。
observedGeneration (int64)
部署控制器觀察到的世代。
DeploymentList
DeploymentList 是 Deployment 的列表。
apiVersion: apps/v1
kind: DeploymentList
metadata (ListMeta)
標準列表元數據。
items ([]Deployment), 必填
Items 是 Deployment 的列表。
Operations
get
讀取指定的 Deployment
HTTP Request
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
Parameters
name (in path): string, 必填
Deployment 的名稱
namespace (in path): string, 必填
pretty (in query): string
Response
200 (Deployment): OK
401: Unauthorized
get
讀取指定 Deployment 的狀態
HTTP Request
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
Parameters
name (in path): string, 必填
Deployment 的名稱
namespace (in path): string, 必填
pretty (in query): string
Response
200 (Deployment): OK
401: Unauthorized
list
列出或監看 Deployment 類型的物件
HTTP Request
GET /apis/apps/v1/namespaces/{namespace}/deployments
Parameters
namespace (in path): string, 必填
allowWatchBookmarks (in query): boolean
continue (in query): string
fieldSelector (in query): string
labelSelector (in query): string
limit (in query): integer
pretty (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
Response
200 (DeploymentList): OK
401: Unauthorized
list
列出或監看 Deployment 類型的物件
HTTP Request
GET /apis/apps/v1/deployments
Parameters
allowWatchBookmarks (in query): boolean
continue (in query): string
fieldSelector (in query): string
labelSelector (in query): string
limit (in query): integer
pretty (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
Response
200 (DeploymentList): OK
401: Unauthorized
create
建立 Deployment
HTTP Request
POST /apis/apps/v1/namespaces/{namespace}/deployments
Parameters
namespace (in path): string, 必填
body: Deployment, 必填
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
pretty (in query): string
Response
200 (Deployment): OK
201 (Deployment): Created
202 (Deployment): Accepted
401: Unauthorized
update
取代指定的 Deployment
HTTP Request
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}
Parameters
name (in path): string, 必填
Deployment 的名稱
namespace (in path): string, 必填
body: Deployment, 必填
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
pretty (in query): string
Response
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
update
取代指定 Deployment 的狀態
HTTP Request
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
Parameters
name (in path): string, 必填
Deployment 的名稱
namespace (in path): string, 必填
body: Deployment, 必填
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
pretty (in query): string
Response
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
patch
部分更新指定的 Deployment
HTTP Request
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}
Parameters
name (in path): string, 必填
Deployment 的名稱
namespace (in path): string, 必填
body: Patch, 必填
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
force (in query): boolean
pretty (in query): string
Response
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
patch
部分更新指定 Deployment 的狀態
HTTP Request
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
Parameters
name (in path): string, 必填
Deployment 的名稱
namespace (in path): string, 必填
body: Patch, 必填
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
force (in query): boolean
pretty (in query): string
Response
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
delete
刪除 Deployment
HTTP Request
DELETE /apis/apps/v1/namespaces/{namespace}/deployments/{name}
Parameters
name (in path): string, 必填
Deployment 的名稱
namespace (in path): string, 必填
body: DeleteOptions
dryRun (in query): string
gracePeriodSeconds (in query): integer
pretty (in query): string
propagationPolicy (in query): string
Response
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
刪除 Deployment 的集合
HTTP Request
DELETE /apis/apps/v1/namespaces/{namespace}/deployments
Parameters
namespace (in path): string, 必填
body: DeleteOptions
continue (in query): string
dryRun (in query): string
fieldSelector (in query): string
gracePeriodSeconds (in query): integer
labelSelector (in query): string
limit (in query): integer
pretty (in query): string
propagationPolicy (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
Response
200 (Status): OK
401: Unauthorized
此頁面為自動產生。
如果您計劃回報此頁面的問題,請在您的問題描述中提及此頁面為自動產生。修正可能需要在 Kubernetes 專案的其他地方進行。