Merge pull request #26062 from notchairmk/cheatsheet_deploy_svc

Update cheatsheet: add interacting with Deployments and Services
This commit is contained in:
Kubernetes Prow Robot 2021-03-04 16:42:22 -08:00 committed by GitHub
commit 203ad6d6a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -320,6 +320,18 @@ kubectl top pod POD_NAME --containers # Show metrics for a given p
kubectl top pod POD_NAME --sort-by=cpu # Show metrics for a given pod and sort it by 'cpu' or 'memory'
```
## Interacting with Deployments and Services
```bash
kubectl logs deploy/my-deployment # dump Pod logs for a Deployment (single-container case)
kubectl logs deploy/my-deployment -c my-container # dump Pod logs for a Deployment (multi-container case)
kubectl port-forward svc/my-service 5000 # listen on local port 5000 and forward to port 5000 on Service backend
kubectl port-forward svc/my-service 5000:my-service-port # listen on local port 5000 and forward to Service target port with name <my-service-port>
kubectl port-forward deploy/my-deployment 5000:6000 # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>
kubectl exec deploy/my-deployment -- ls # run command in first Pod and first container in Deployment (single- or multi-container cases)
```
## Interacting with Nodes and cluster
```bash