.gitlab-ci.yml for “ansible-lint”

So I started working with GitLab (self-hosted and gitlab.com), which led me to the CI/CD features of GitLab. When using GitLab, one can define a custom CI pipeline just by placing a .gitlab-ci.yml file in your project (just like the .travis.yml for GitHub). After each commit to the defined git branch, the pipeline is then executed.

Since I also work with Ansible playbooks a lot, I wanted to use ansible-lint to check my playbooks after each commit. In addition to that, I also added a syntax check using ansible-playbook [..] --syntax-check, as ansible-lint will not pick up all syntax errors.

So here is my .gitlab-ci.yml:

Read the rest of this entry

Java Service Wrapper 3.5.35 for Windows x64

A user of the Tanuki Service Wrapper reminded me that Tanuki released version 3.5.35 of the Java Service Wrapper some time ago. So in this post, I can provide version 3.5.35 of the Java Service Wrapper for Windows x64.

As always, I don’t guarantee anything, so please note:

Read the rest of this entry

Kubernetes: BASH function to change namespace

So when working with a lot of different namespaces in Kubernetes and you only know the “oc project” command from OpenShift, you start to miss an easy way to change namespaces in Kubernetes.

The official documentation to switch namespaces proposes something like this:

$ kubectl config set-context $(kubectl config current-context) --namespace=<insert-namespace-name-here>

Not something that I want to type regularly. First I tried to create a BASH alias or something, which did not work. So I looked around for BASH functions. I found that Jon Whitcraft proposed a nice BASH function in a GitHub issue. I lightly modified this and placed this in my own .bashrc file:

function kubectlns() {
  ctx=`kubectl config current-context`
  ns=$1

  # verify that the namespace exists
  ns=`kubectl get namespace $1 --no-headers --output=go-template={{.metadata.name}} 2>/dev/null`
  if [ -z "${ns}" ]; then
    echo "Namespace (${1}) not found, using default"
    ns="default"
  fi

  kubectl config set-context ${ctx} --namespace="${ns}"
}

So to change your namespace, use something like this:

$ kubectlns simon
Context "kubernetes-admin@kubernetes" modified.

Nice and short.

Presentation at Open Source Workshop Deutsche Bahn

On the 28th of November, me and my colleagues from SBB had the honor of speaking at the Open Source Workshop at Deutsche Bahn in Frankfurt.

Deutsche Bahn (the German counterpart to SBB, where I currently work) is looking to invest more in Open Source technology and also container platforms. This is why they are holding a yearly Open Source Workshop. Me and my colleagues from SBB are big supporters of Open Source software (SBB has lots of stuff on GitHub) and we also participate in the OpenShift Container Platform Community Switzerland (also on GitHub).

So in our presentation, we mainly talked about operating OpenShift at scale, our Open Source tools and why we participate in Open Source software. You can find more information on Twitter. We had a lot of fun and are looking forward to joining Deutsche Bahn again next year – if we are invited ;).

AWS Certified SysOps Administrator – Associate

At SBB, for some workload we are leveraging the wonderful capabilities of Amazon Web Services. As a result, I have been working a lot more with AWS for the past few months and have decided to go for the SysOps certification. So here we go, I am now an “AWS Certified SysOps Administrator – Associate”:

While some AWS services are not perfect, I enjoy it very much to work with such a great platform. I am even thinking about getting more AWS certifications :).

OpenShift: Add or remove label

So when using NodeSelectors in OpenShift, you’ll also have to set labels on your nodes. You can find more information on labeling nodes in the OpenShift documentation. Here is how you can add or remove a label from a node or pod:

To add a label to a node or pod:

# oc label node node001.krenger.ch mylabel=myvalue
# oc label pod mypod-34-g0f7k mylabel=myvalue

To remove a label (in the example “mylabel”) from a node or pod:

# oc label node node001.krenger.ch mylabel-
# oc label pod mypod-34-g0f7k mylabel-

You can also use oc label -h to see more options for the oc label command.

Release of “MySQL 8 Recipes”

In the past few months, I worked closely with Packt Publishing to create a new video course for MySQL 8. Today, the video course was released into the world. I am pround to present to you the new video course “MySQL 8 Recipes“:

In this video course, I tried to include the most common tasks for database administrators while focussing on the new features of MySQL 8. I included the following main chapters:

  • Install and configure a new MySQL 8 database
  • Upgrade existing databases to MySQL 8
  • Perform typical administration tasks
  • Master the new querying features in MySQL 8
  • Perform performance-tuning tasks
  • Optimize your database
  • Access databases with PHP, Python, or Java

The video course was released under ISBN-13 9781788393638 and is available per now. Of course, since MySQL 8 is still under development, there will hopefully be many other new features in the new release. But I hope you enjoy this video course. Purchase it here.

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Elsewhere

  1. GitHub
  2. LinkedIn
  3. GitLab