网站首页 文章专栏 02deployment.md
主要介绍如何使用rest api调度deployment资源。
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
GET /apis/apps/v1/namespaces/{namespace}/deployments
GET /apis/apps/v1/deployments
POST /apis/apps/v1/namespaces/{namespace}/deployments
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}
DELETE /apis/apps/v1/namespaces/{namespace}/deployments/{name}
DELETE /apis/apps/v1/namespaces/{namespace}/deployments
curl -X POST -H 'Content-Type: application/yaml' --data '
apiVersion: apps/v1
kind: Deployment
metadata:
name: tensorflow
spec:
replicas: 1
selector:
matchLabels:
app: tensorflow
template:
metadata:
name: tensorflow
labels:
app: tensorflow
spec:
containers:
- name: tensorflow
imagePullPolicy: IfNotPresent
image: tensorflow1_18:v2
ports:
- containerPort: 6081
nodePort: 6081
resources:
limits:
cpu: 10m
memory: 4096Mi
requests:
cpu: 10m
memory: 4096Mi
' -u admin:admin https://192.168.25.180:6443/apis/apps/v1/namespaces/default/deployments -k
curl -X DELETE -H 'Content-Type: application/yaml' --data '
gracePeriodSeconds: 0
orphanDependents: false
' 'http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments/deployment-example'
参考:
TODO