Skip to content

Instantly share code, notes, and snippets.

@irokhes
Forked from UlisesGascon/k8s_commands.md
Last active February 20, 2020 22:37
Show Gist options
  • Save irokhes/20c0ba69253d007ee887d593054dee0b to your computer and use it in GitHub Desktop.
Save irokhes/20c0ba69253d007ee887d593054dee0b to your computer and use it in GitHub Desktop.

Restart deployment

kubectl rollout restart deploy/admission-control

Instalación

$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version

Contextos

# Cargar
$ export KUBECONFIG=/.../k8s_read_cluster.conf
# Listar
$ kubectl config get-contexts
# Usar
$ kubectl config use-context staging

Recursos

# Listar todos los pods
$ kubectl get pods --all-namespaces

# Pods de WUR
$ kubectl get pods --namespace wur

# Pods de Development para WUR
$ kubectl get pods --namespace wur --context development

# Listar todos los servicios
$ kubectl get services

Manejo de pods

# Listar pods
kubectl get pods --namespace wur --context staging

#Log de un Pod
kubectl logs service-amqp2salesforce-545f58bb7c-5n62h --namespace wur --context staging

#Log de un Pod Live 
kubectl logs --follow service-amqp2salesforce-545f58bb7c-5n62h --namespace wur --context staging

# Describe del pod
kubectl describe pod  service-amqp2salesforce-545f58bb7c-5n62h --namespace wur --context staging

Historico de deployemnts y Rollback

# Historico de deployment
kubectl rollout history deployment/app-backend

# Rollback a un deployment especifico
kubectl rollout undo deployment/app-backend --to-revision=2

Manejo de Cronjobs

# Listar los cronjobs
kubectl get cronjobs --namespace wur --context staging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment