Se corrige README
This commit is contained in:
parent
ad8c80453f
commit
594ad62462
228
README.md
228
README.md
@ -110,173 +110,223 @@ Una herramienta gráfica excelente es *lens*, que muestra los contenedores de un
|
|||||||
#### Nodes
|
#### Nodes
|
||||||
```
|
```
|
||||||
kubectl get no
|
kubectl get no
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get no -o wide
|
kubectl get no -o wide
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe no
|
kubectl describe no
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get no -o yaml
|
kubectl get no -o yaml
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get node –select or =[ label _name]
|
kubectl get node –select or =[ label _name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type==”ExternalIP”)].address}’
|
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type==”ExternalIP”)].address}’
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl top node [node_name]
|
kubectl top node [node_name]
|
||||||
```
|
```
|
||||||
#### ods
|
#### ods
|
||||||
```
|
```
|
||||||
kubectl get po
|
kubectl get po
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get po -o wide
|
kubectl get po -o wide
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe po
|
kubectl describe po
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get po –show-labels
|
kubectl get po –show-labels
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get po -l app=nginx
|
kubectl get po -l app=nginx
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get po -o yaml
|
kubectl get po -o yaml
|
||||||
|
```
|
||||||
|
```
|
||||||
kubect l get pod [ pod_name] -o yaml –export
|
kubect l get pod [ pod_name] -o yaml –export
|
||||||
|
```
|
||||||
|
```
|
||||||
kubect l get pod [pod_name] -o yaml –export > nameoffile.yaml
|
kubect l get pod [pod_name] -o yaml –export > nameoffile.yaml
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get pods –field-selector status.phase=Running
|
kubectl get pods –field-selector status.phase=Running
|
||||||
```
|
```
|
||||||
#### Namespaces
|
#### Namespaces
|
||||||
```
|
```
|
||||||
kubectl get ns
|
kubectl get ns
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get ns -o yaml
|
kubectl get ns -o yaml
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe ns
|
kubectl describe ns
|
||||||
```
|
```
|
||||||
#### Deployments
|
#### Deployments
|
||||||
```
|
```
|
||||||
kubectl get deploy
|
kubectl get deploy
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe deploy
|
kubectl describe deploy
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get deploy -o wide
|
kubectl get deploy -o wide
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get deploy -o yam
|
kubectl get deploy -o yam
|
||||||
```
|
```
|
||||||
#### Services
|
#### Services
|
||||||
```
|
```
|
||||||
kubectl get svc
|
kubectl get svc
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe svc
|
kubectl describe svc
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get svc -o wide
|
kubectl get svc -o wide
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get svc -o yaml
|
kubectl get svc -o yaml
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get svc –show-labels
|
kubectl get svc –show-labels
|
||||||
```
|
```
|
||||||
#### DaemonSets
|
#### DaemonSets
|
||||||
```
|
```
|
||||||
kubectl get ds
|
kubectl get ds
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get ds –all-namespaces
|
kubectl get ds –all-namespaces
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe ds [daemonset _name] -n [namespace_name]
|
kubectl describe ds [daemonset _name] -n [namespace_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get ds [ds_name] -n [ns_name] -o yaml
|
kubectl get ds [ds_name] -n [ns_name] -o yaml
|
||||||
```
|
```
|
||||||
#### Events
|
#### Events
|
||||||
```
|
```
|
||||||
kubectl get events
|
kubectl get events
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get events -n kube-system
|
kubectl get events -n kube-system
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get events -w
|
kubectl get events -w
|
||||||
```
|
```
|
||||||
#### Logs
|
#### Logs
|
||||||
```
|
```
|
||||||
kubectl logs [pod_name]
|
kubectl logs [pod_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl logs –since=1h [pod_name]
|
kubectl logs –since=1h [pod_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl logs –tail =20 [pod_name]
|
kubectl logs –tail =20 [pod_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl logs -f -c [container_name] [pod_name]
|
kubectl logs -f -c [container_name] [pod_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl logs [pod_name] > pod.log
|
kubectl logs [pod_name] > pod.log
|
||||||
```
|
```
|
||||||
#### Service Accounts
|
#### Service Accounts
|
||||||
```
|
```
|
||||||
kubectl get sa
|
kubectl get sa
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get sa -o yaml
|
kubectl get sa -o yaml
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get serviceaccounts default -o yaml > ./sa.yaml
|
kubectl get serviceaccounts default -o yaml > ./sa.yaml
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl replace serviceaccount default -f. /sa.yaml
|
kubectl replace serviceaccount default -f. /sa.yaml
|
||||||
```
|
```
|
||||||
#### ReplicaSets
|
#### ReplicaSets
|
||||||
```
|
```
|
||||||
kubectl get rs
|
kubectl get rs
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe rs
|
kubectl describe rs
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get rs -o wide
|
kubectl get rs -o wide
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get rs -o yaml
|
kubectl get rs -o yaml
|
||||||
```
|
```
|
||||||
#### Roles
|
#### Roles
|
||||||
```
|
```
|
||||||
kubectl get roles –all-namespaces
|
kubectl get roles –all-namespaces
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get roles –all-namespaces -o yaml
|
kubectl get roles –all-namespaces -o yaml
|
||||||
```
|
```
|
||||||
#### Secrets
|
#### Secrets
|
||||||
```
|
```
|
||||||
kubectl get secrets
|
kubectl get secrets
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get secrets –all-namespaces
|
kubectl get secrets –all-namespaces
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get secrets -o yaml
|
kubectl get secrets -o yaml
|
||||||
```
|
```
|
||||||
#### ConfigMaps
|
#### ConfigMaps
|
||||||
```
|
```
|
||||||
kubectl get cm
|
kubectl get cm
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get cm –all-namespaces
|
kubectl get cm –all-namespaces
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get cm –all-namespaces -o yaml
|
kubectl get cm –all-namespaces -o yaml
|
||||||
```
|
```
|
||||||
#### Ingress
|
#### Ingress
|
||||||
```
|
```
|
||||||
kubectl get ing
|
kubectl get ing
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get ing –all-namespaces
|
kubectl get ing –all-namespaces
|
||||||
```
|
```
|
||||||
#### PersistentVolume
|
#### PersistentVolume
|
||||||
```
|
```
|
||||||
kubectl get pv
|
kubectl get pv
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe pv
|
kubectl describe pv
|
||||||
```
|
```
|
||||||
#### PersistentVolumeClaim
|
#### PersistentVolumeClaim
|
||||||
```
|
```
|
||||||
kubectl get pvc
|
kubectl get pvc
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl describe pvc
|
kubectl describe pvc
|
||||||
```
|
```
|
||||||
#### StorageClass
|
#### StorageClass
|
||||||
```
|
```
|
||||||
kubectl get sc
|
kubectl get sc
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get sc -o yaml
|
kubectl get sc -o yaml
|
||||||
```
|
```
|
||||||
#### MultipleResources
|
#### MultipleResources
|
||||||
```
|
```
|
||||||
kubectl get svc, po
|
kubectl get svc, po
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get deploy, no
|
kubectl get deploy, no
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get all
|
kubectl get all
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get all –all-namespaces
|
kubectl get all –all-namespaces
|
||||||
```
|
```
|
||||||
### Modificar atributos de los recursos
|
### Modificar atributos de los recursos
|
||||||
@ -287,13 +337,15 @@ kubectl taint [node_name] [taint _name]
|
|||||||
#### Labels
|
#### Labels
|
||||||
```
|
```
|
||||||
kubectl label [node_name] disktype=ssd
|
kubectl label [node_name] disktype=ssd
|
||||||
|
```
|
||||||
|
```
|
||||||
kubrectl label [pod_name] env=prod
|
kubrectl label [pod_name] env=prod
|
||||||
```
|
```
|
||||||
#### Cordon/Uncordon
|
#### Cordon/Uncordon
|
||||||
```
|
```
|
||||||
kubectl cordon [node_name]
|
kubectl cordon [node_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl uncordon [node_name]
|
kubectl uncordon [node_name]
|
||||||
```
|
```
|
||||||
#### Drain
|
#### Drain
|
||||||
@ -303,62 +355,78 @@ kubectl drain [node_name]
|
|||||||
#### Nodes/Pods
|
#### Nodes/Pods
|
||||||
```
|
```
|
||||||
kubectl delete node [node_name]
|
kubectl delete node [node_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl delete pod [pod_name]
|
kubectl delete pod [pod_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl edit node [node_name]
|
kubectl edit node [node_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl edit pod [pod_name]
|
kubectl edit pod [pod_name]
|
||||||
```
|
```
|
||||||
#### Deployments/Namespaces
|
#### Deployments/Namespaces
|
||||||
```
|
```
|
||||||
kubectl edit deploy [deploy_name]
|
kubectl edit deploy [deploy_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl delete deploy [deploy_name]
|
kubectl delete deploy [deploy_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl expose deploy [depl oy_name] –port=80 –type=NodePort
|
kubectl expose deploy [depl oy_name] –port=80 –type=NodePort
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl scale deploy [deploy_name] –replicas=5
|
kubectl scale deploy [deploy_name] –replicas=5
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl delete ns
|
kubectl delete ns
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl edit ns [ns_name]
|
kubectl edit ns [ns_name]
|
||||||
```
|
```
|
||||||
#### Services
|
#### Services
|
||||||
```
|
```
|
||||||
kubectl edit svc [svc_name]
|
kubectl edit svc [svc_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl delete svc [svc_name]
|
kubectl delete svc [svc_name]
|
||||||
```
|
```
|
||||||
#### DaemonSets
|
#### DaemonSets
|
||||||
```
|
```
|
||||||
kubectl edit ds [ds_name] -n kube-system
|
kubectl edit ds [ds_name] -n kube-system
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl delete ds [ds_name]
|
kubectl delete ds [ds_name]
|
||||||
```
|
```
|
||||||
#### ServiceAccounts
|
#### ServiceAccounts
|
||||||
```
|
```
|
||||||
kubectl edit sa [sa_name]
|
kubectl edit sa [sa_name]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl delete sa [sa_name]
|
kubectl delete sa [sa_name]
|
||||||
```
|
```
|
||||||
#### Annotate
|
#### Annotate
|
||||||
```
|
```
|
||||||
kubectl annotate po [pod_name] [annotation]
|
kubectl annotate po [pod_name] [annotation]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl annotate no [node_name]
|
kubectl annotate no [node_name]
|
||||||
```
|
```
|
||||||
### Añadir recursos
|
### Añadir recursos
|
||||||
#### Crear Pod
|
#### Crear Pod
|
||||||
```
|
```
|
||||||
kubectl create -f [name_of _file]
|
kubectl create -f [name_of _file]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl apply -f [name_of _file]
|
kubectl apply -f [name_of _file]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl run [pod_name] –image=ngi nx –restart=Never
|
kubectl run [pod_name] –image=ngi nx –restart=Never
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl run [ pod_name] –generator =run-pod/v1 –image=nginx
|
kubectl run [ pod_name] –generator =run-pod/v1 –image=nginx
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl run [ pod_name] –image=nginx –restart=Never
|
kubectl run [ pod_name] –image=nginx –restart=Never
|
||||||
```
|
```
|
||||||
#### Crear un Service
|
#### Crear un Service
|
||||||
@ -368,9 +436,11 @@ kubectl create svc nodeport [svc_name] –tcp=8080:80
|
|||||||
#### Crear Deployment
|
#### Crear Deployment
|
||||||
```
|
```
|
||||||
kubectl create -f [name_of _file]
|
kubectl create -f [name_of _file]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl apply -f [name_of _file]
|
kubectl apply -f [name_of _file]
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl create deploy [deploy_name] –image=ngi nx
|
kubectl create deploy [deploy_name] –image=ngi nx
|
||||||
```
|
```
|
||||||
#### Interactive Pod
|
#### Interactive Pod
|
||||||
@ -380,17 +450,21 @@ kubectl run [pod_name] –image=busybox –rm -it –restart=Never — sh
|
|||||||
#### Salida de YAMLto en un fichero
|
#### Salida de YAMLto en un fichero
|
||||||
```
|
```
|
||||||
kubectl create deploy [deploy_name] –image=ngi nx –dry-run -o yaml > deploy.yaml
|
kubectl create deploy [deploy_name] –image=ngi nx –dry-run -o yaml > deploy.yaml
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get po [pod_name] -o yaml –export > pod. yaml
|
kubectl get po [pod_name] -o yaml –export > pod. yaml
|
||||||
```
|
```
|
||||||
#### Ayuda
|
#### Ayuda
|
||||||
```
|
```
|
||||||
kubectl -h
|
kubectl -h
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl create -h
|
kubectl create -h
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl run -h
|
kubectl run -h
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl explain deploy.spec
|
kubectl explain deploy.spec
|
||||||
```
|
```
|
||||||
### Solicitaciones
|
### Solicitaciones
|
||||||
@ -401,9 +475,11 @@ kubectl get –raw /apis/metrics.k8s.io/
|
|||||||
#### Información del Cluster
|
#### Información del Cluster
|
||||||
```
|
```
|
||||||
kubectl config
|
kubectl config
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl cluster -info
|
kubectl cluster -info
|
||||||
|
```
|
||||||
|
```
|
||||||
kubectl get componentstatuses
|
kubectl get componentstatuses
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user