Flushing dns caching in linux

Problem

You want to update your dns resolution locally after some change in DNS.

You want to do this because your local dns cache still holds the old information about the domain. For example using your local dns and the google one returns two different results

host changed_domain.com
returns the old ip

host changed_domain.com 8.8.8.8
returns the new ip.

Solution

Check your systemd-resolved is active:

sudo systemctl is-active systemd-resolved
active

Get some statistics:

sudo systemd-resolve --statistics

Transactions
Current Transactions: 0
  Total Transactions: 38818

Cache
  Current Cache Size: 73
          Cache Hits: 21120
        Cache Misses: 19745

DNSSEC Verdicts
              Secure: 0
            Insecure: 0
               Bogus: 0
       Indeterminate: 0

Flush the cache (make the Current Cache Size above 0)

sudo systemd-resolve --flush-caches

Check the cache again (should be 0 now):

sudo systemd-resolve --statistics

ransactions
Current Transactions: 0
  Total Transactions: 38818

Cache
  Current Cache Size: 0
          Cache Hits: 21120
        Cache Misses: 19745

DNSSEC Verdicts
              Secure: 0
            Insecure: 0
               Bogus: 0
       Indeterminate: 0

Information taken from https://www.techrepublic.com/article/how-to-flush-the-dns-cache-on-linux/

Using exo cli to display your vm templates in Exoscale

To display your vm templates, as opposed to all available templates in Exoscale using the exo CLI, use the following (you should have already the environment variables set up to be able to use exo):

exo vm template list --mine
?????????????????????????????????????????????????????????????????????????????????????????????????????????
?                  ID                  ?     NAME      ?      CREATION DATE       ?  ZONE   ? DISK SIZE ?
?????????????????????????????????????????????????????????????????????????????????????????????????????????
? a58f0180-689d-4663-aa53-91111111111  ? my-ubuntu     ? 2020-08-12T13:44:01+0000 ? ch-dk-2 ? 50 GiB    ?
?????????????????????????????????????????????????????????????????????????????????????????????????????????

WARNING: Pulling GitLab Runner helper image from Docker Hub. Helper image is migrating to registry.gitlab.com, for more information see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#migrating-helper-image-to-registrygitlabcom

To change this in your gitlab-runner configuration, depends on the version of your gitlab-runner as described in https://docs.gitlab.com/runner/configuration/feature-flags.html

If you version is 13.9.0 (gitlab-runner –version), then add the following in ~/.gitlab-runner/config.toml

[[runners]]
  name = "gitlab-runner-name"
  request_concurrency = 1
  url = "https://git.url.test/"
  token = "xckaxxxxxxxx"
  executor = "kubernetes"
  environment = ["FF_GITLAB_REGISTRY_HELPER_IMAGE=1"]

Error: Invalid provider configuration (terraform plan locally with TerraformCloud)

Problem

You are trying to run locally the terraform plan, while using the Terraform’s Cloud remote backend, before commiting your changes to your repo and running it through Terraform’s Cloud UI, and you are getting the previous error message:

Error: Invalid provider configuration

Solution

Remember to add the environment variables needed for your provider (AWS, Google, Exoscale etc) in the Variables section of your Terraform Cloud setup.

Even you have added them before, using a new Workspace means you will need to add them to each new workspace.

asdf and terraform (or vault or packer)

Using the asdf version manager to manage versions of various binaries like terraform, vault or packer is easily done by following the instructions below:

  1. Download and install asdf if you haven’t got it already (https://asdf-vm.com/#/core-manage-asdf)
  2. If you want to install the latest version of terraform for example do the following:
asdf plugin add terraform
asdf install terraform latest
asdf global terraform 0.14.9
asdf list
terraform
  0.14.9
terraform --version
Terraform v0.14.9

Get/Set platform information

To get or set in environment variables the platform information of a system you can use the following:

export ARCH=$(case $(arch) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(arch) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')

Taken from the installation instructions of the Operator SKD here: https://master.sdk.operatorframework.io/docs/installation/

Upgrading node and yarn

Problem

You are getting the following error when trying to use yarn:

$ yarn
yarn install v1.21.1
[1/5] Validating package.json...
error xxxxx@: The engine "node" is incompatible with this module. Expected version "^10.0.0". Got "8.10.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Solution

Upgrade yarn

$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
[sudo] password for username: 
OK

$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
deb https://dl.yarnpkg.com/debian/ stable main

$ sudo apt-get update
$ sudo apt-get upgrade

Which should give the updated yarn version:

$ yarn
yarn install v1.22.5
[1/5] Validating package.json...
error xxxxx@: The engine "node" is incompatible with this module. Expected version "^10.0.0". Got "8.10.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Upgrade node version with the correct version from above (ie 10.0.0)

$ curl -fsSL https://deb.nodesource.com/setup_10.x | sudo -E bash -

$ sudo apt-get install -y nodejs
....
The following packages will be upgraded:
  nodejs
...

And then the needed versions would have been installed:

$ yarn
yarn install v1.22.5
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.90s.