Your cart is currently empty!
Kubernetes: Deployments via CURL
Forward Kubernetes API server to localhost port 8001.
kubectl proxy
Get all deployments from default namespace.
curl http://localhost:8001/apis/apps/v1/namespaces/default/deployments
Get specific deployment from default namespace.
curl http://localhost:8001/apis/apps/v1/namespaces/default/deployments/{deployment-name}
Create deployment.
curl -X POST -H 'Content-Type: application/yaml' --data ' apiVersion: apps/v1 kind: Deployment metadata: name: deployment-example spec: # replicas: 3 # revisionHistoryLimit: 10 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14 # ports: # - containerPort: 80 ' http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments
curl -X POST -H 'Content-Type: application/yaml' --data "$(cat deployment.yaml)" http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments
curl -X POST -H 'Content-Type: application/yaml' --data-binary @deployment.yaml http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments
curl -X POST -H 'Content-Type: application/yaml' --data-binary @/path/to/deployment.yaml http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments
cat deployment.yaml | curl -X POST -H 'Content-Type: application/yaml' --data-binary @- http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments
References:
Leave a Reply