Skip to content

Instantly share code, notes, and snippets.

@airtonGit
Last active May 18, 2020 18:08
Show Gist options
  • Save airtonGit/fb398d9aabd6bde4e760345c031da33f to your computer and use it in GitHub Desktop.
Save airtonGit/fb398d9aabd6bde4e760345c031da33f to your computer and use it in GitHub Desktop.
Migrando do Docker Swarm para Kubernetes, comandos lado a lado e identificando problemas

Kubernetes vs Docker

swarm kubernetes
docker service list kubectl get pods
docker service logs service-name kubectl logs deployment-name container-name
docker exec -it container-id command kubectl exec -it pod-name [-c container-name] -- command
kubectl describe pod/srv pod-name/srv-name

Container Image Auto Update

The imagePullPolicy and the tag of the image affect when the kubelet attempts to pull the specified image.

imagePullPolicy: IfNotPresent: the image is pulled only if it is not already present locally.

imagePullPolicy: Always: the image is pulled every time the pod is started.

imagePullPolicy is omitted and either the image tag is :latest or it is omitted: Always is applied.

imagePullPolicy is omitted and the image tag is present but not :latest: IfNotPresent is applied.

imagePullPolicy: Never: the image is assumed to exist locally. No attempt is made to pull the image.

So to achieve this you have to set imagePullPolicy: Always and restart you pod and it should pull a fresh latest copy of image. I don't think there is any other way in K8s

Fonte: https://stackoverflow.com/questions/59543373/auto-update-container-image-when-new-build-released-on-kubernetes

Debuging

containers in pod:

'''kubectl describe pod/hotelpago-deployment-8997fb557-jl68z -n default

Listar status

kubectl describe pods

Expor Cluster para Internet

Executar BASH dentro do container

kubectl exec -it nome-deployment -c nome-container -- /bin/bash

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