网站首页 文章专栏 03service.md
主要介绍如何使用rest api调度service资源。
GET /api/v1/namespaces/{namespace}/services/{name}
GET /api/v1/namespaces/{namespace}/services
GET /api/v1/services
POST /api/v1/namespaces/{namespace}/services
PATCH /apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}
PUT /apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}
DELETE /apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}
DELETE /apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies
curl -X POST -H 'Content-Type: application/yaml' --data '
kind: Service
apiVersion: v1
metadata:
name: service-example
spec:
ports:
- name: http
port: 80
targetPort: 80
selector:
app: nginx
type: LoadBalancer
' http://127.0.0.1:8001/api/v1/namespaces/default/services
curl -X DELETE -H 'Content-Type: application/yaml' --data '
gracePeriodSeconds: 0
orphanDependents: false
' 'http://127.0.0.1:8001/api/v1/namespaces/default/services/deployment-example'
参考:
TODO