Update cheatsheet: add section for interacting with Deployments and Services
This commit is contained in:
@@ -317,6 +317,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'
|
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
|
## Interacting with Nodes and cluster
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user