Skip to content

Instantly share code, notes, and snippets.

@UlisesGascon
Last active October 21, 2019 08:57
Show Gist options
  • Save UlisesGascon/8c3c800d7121df20cb34bd5c85abcdd6 to your computer and use it in GitHub Desktop.
Save UlisesGascon/8c3c800d7121df20cb34bd5c85abcdd6 to your computer and use it in GitHub Desktop.

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

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