2 min read
One common misunderstanding with kubernetes is mistakenly assume "a pod" really means "a container".
A pod is the minimal unit we take into account in kubernetes but this does not mean that a pod is a container: A pod can be composed of several containers working together. We can easily see this on the READY column that are going to tell us for a given pod from how many containers it is composed:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
ampa-7dcbfd689f-59ghw 2/2 Running 0 5d1h
12/03/2021
Read more...2 min read
On terraform, besides returning some information to the user, returning data as output can be used as an input for terraform code that needs to use a resource created by another team.
On the terraform code that creates the resource, we will have to set the variable and it's value:
output endpoint {
vpc_id = aws_vpc.databases.id
}
Then, on the code that uses this resource we will have to declare the tfstate as a data source using terraform_remote_state
11/03/2021
Read more...2 min read
On most kubectl command we will find the selector option for filtering pods based on it's labels. To use we just need to set the filter using the key=value format:
$ kubectl get pods -l "app=spin"
NAME READY STATUS RESTARTS AGE
spin-clouddriver-9899c9b54-nbjp6 1/1 Running 0 29h
spin-deck-56ff48c587-lc75g 1/1 Running 0 29h
spin-echo-7ccf545b48-b5n9l 1/1 Running 0 29h
spin-front50-59bff89745-2f65h 1/1 Running 0 29h
spin-gate-644c968b68-2q8nj 1/1 Running 0 29h
spin-igor-6669794575-2cnb4 1/1 Running 0 29h
spin-orca-795789b678-nqrk7 1/1 Running 0 29h
spin-rosco-6c9879b69f-gdrfl 1/1 Running 0 29h
10/03/2021
Read more...2 min read
Sometimes with terraform you might end up with some meaningless error that does not provide any clue what's going on. So instead or just trying to guess that have changed; we can enable some traces in terraform to try to make sense what's going on
Error: AccessDenied: Access Denied
status code: 403, request id: 8FCD12996B11F5F8, host id: xMF1Gs+VIEpxpk+1Og6UtchyT10K+mRWFe2IUZ8gqG13KbsRm0L8nRw8udzkqEVJagg8+RMpY3M=
09/03/2021
Read more...2 min read
When using local-exec with the null_resource we might need to be able to update the resources that gets created like this. Let's assume we have the following terraform code to apply Kustomize to a kubernetes cluster:
resource "null_resource" "metrics-server" {
provisioner "local-exec" {
command = "kubectl apply -k 'https://github.com/jordiprats/django-ampa/deploy-${var.version}/'"
}
}
Given this setup even though the var.version changed, the resource won't be updated if it was already applied
08/03/2021
Read more...