2 min read
To be able to save data generated using terraform to be able to import the terraform state somewhere else using terraform_remote_state or retrieving it using the CLI we need to use the output directive:
output "alb_dns_name" {
description = "ALB DNS name"
value = aws_alb.jenkins-alb.dns_name
}
16/04/2021
Read more...2 min read
The Xmx and Xms settings are most commonly overlooked settings but yet quite critical for the JVM to perform as expected. They control the JVM's heap: the memory area where objects are instantiated.
15/04/2021
Read more...2 min read
You can use kubectl drain to evict pods from a node and mark it as unschedulable to prevent new pods from get created on this node. It will allow the pod's containers to gracefully terminate, respecting the PodDisruptionBudgets with a few exceptions. Let's test it suing the following nodes:
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
nauvoo.pet2cattle.com Ready control-plane,master 19d v1.20.4+k3s1
tycho.pet2cattle.com Ready <none> 26s v1.20.4+k3s1
14/04/2021
Read more...4 min read
If we try compare volumeMounts with the actual mounts that we have on a pod using, for example, df it can be quite confusing due to the usage of the overlay filesystem
Let's consider the volumeMounts section of a deploy:
$ kubectl get deploy pet2cattle -o yaml
(...)
volumeMounts:
- mountPath: /opt/pet2cattle/conf
name: config
- mountPath: /opt/pet2cattle/data
name: pet2cattle
subPath: data
- mountPath: /opt/pet2cattle/lib
name: pet2cattle
subPath: lib
- mountPath: /tmp
name: tmp-dir
(...)
And compare it with the filesystem we see on the pod:
$ kubectl exec pet2cattle-8475d6697-jbmsm -- df -hP
Filesystem Size Used Avail Use% Mounted on
overlay 100G 9.7G 91G 10% /
tmpfs 64M 0 64M 0% /dev
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/xvda1 100G 9.7G 91G 10% /tmp
shm 64M 0 64M 0% /dev/shm
/dev/xvdcu 20G 2.5G 18G 13% /opt/pet2cattle/lib
tmpfs 3.9G 12K 3.9G 1% /run/secrets/kubernetes.io/serviceaccount
tmpfs 3.9G 0 3.9G 0% /proc/acpi
tmpfs 3.9G 0 3.9G 0% /proc/scsi
tmpfs 3.9G 0 3.9G 0% /sys/firmware
13/04/2021
Read more...1 min read
While debugging an issue it can be quite handy to be able to inspect the terraform state. We can inspect specific resources by using terraform state show
12/04/2021
Read more...2 min read
On a Windows server there's also a way of fitering other command's output just like you would do using grep on a Linux: You can do it using find and findstr
09/04/2021
Read more...2 min read
When using a remote terraform state with S3, it is recomended to use a dynamoDB table for:
For example:
terraform {
backend "s3" {
bucket = "infra-tfstate"
key = "jenkins/terraform.tfstate"
region = "eu-west-1"
dynamodb_table = "terraform_locks"
}
}
08/04/2021
Read more...2 min read
Due to the need to use the count keyword for making a resource optional I wanted to upgrade from terraform 0.12 to 0.13 but while doing so I found the following error:
Error: Provider configuration not present
To work with module.jenkins.aws_iam_policy.jenkins_policy
its original provider configuration at provider["registry.terraform.io/-/aws"]
is required, but it has been removed. This occurs when a provider
configuration is removed while objects created by that provider still exist in
the state. Re-add the provider configuration to destroy
module.jenkins.aws_iam_policy.jenkins_policy, after which
you can remove the provider configuration again.
07/04/2021
Read more...2 min read
On a previous post we saw how to test we can assume a role using AWS CLI but how can we configure AWS CLI to assume an specific role before performing some request? We can do it using a profile to save us from the trouble of having to change three different environment variables.
06/04/2021
Read more...3 min read
On a previous post we saw how ridiculously easy is to bootstrap a k3s cluster on a Raspberry Pi but what do we need to do to join new worker nodes to the cluster?
05/04/2021
Read more...