19. December 2019

Install Jenkins by Helm to Kubernetes on Azure

Here you can find instructions for installing Jenkins on Kubernetes running on Microsoft Azure. The main advantage of deployment Jenkins on Kubernetes is the automatic scaling of agents.

How to do it?

First of all, you’ll need an account at portal.azure.com. Microsoft provides credit for new registration. If you have MSDN subscription you’ll get some credit which is available at portal my.visualstudio.com.

Software prerequisites:

  • Install Docker Desktop (not Desktop Enterprise). The installation also contains kubectl command from Kubernetes.
  • Install Helm.
  • Install Azure CLI.

Create Kubernetes infrastructure.

az aks create -n kube-jenkins --resource-group kube-jenkins-group \
  --node-count 1 --node-vm-size Standard_B2ms

Retrieve credentials for working with Kubernetes cluster on Azure.

az aks get-credentials -g kube-jenkins-group -n kube-jenkins

Switch to newly created Kubernetes.

kubectl config use-context kube-jenkins

Install Jenkins on Kubernetes by Helm.

helm install jenkins stable/jenkins

Retrieve password for admin user to login to Kubernetes.

printf $(kubectl get secret --namespace default jenkins \
  -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo

Create a tunnel from your computer to Kubernetes cluster. It will allow you to access port 8080 on localhost and the request will be forwarded to Jenkins on Kubernetes. With this command you do not need to install Ingress controller, so the setup is a little bit more secure than exposing Jenkins to internet.

export POD_NAME=$(kubectl get pods --namespace default \
  -l "app.kubernetes.io/component=jenkins-master" \
  -l "app.kubernetes.io/instance=jenkins" -o jsonpath="{.items[0].metadata.name}")
  echo http://127.0.0.1:8080
  kubectl --namespace default port-forward $POD_NAME 8080:8080

Go to web browser and type URL http://localhost:8080

Login is admin and password was retrieved by the command above.

If you’d like to remove Jenkins installation just type:

helm uninstall jenkins
Facebook Comments

5. December 2019

Helm 3.x fails with Error: must either provide a name or specify –generate-name

If you follow tutorials on using Helm, it might happen that they’re outdated, because they’re targeting Helm 2.x.

Following command for install will fail with error:

helm install -n aks-georgik-rocks aks-georgik-rocks-chart
Error: must either provide a name or specify --generate-name

The fix is simple. The syntax for helm 3.x is following:

helm install [NAME] [CHART] [flags]

Just remove -n. The command will look like this:

helm install aks-georgik-rocks aks-georgik-rocks-chart
Facebook Comments

19. September 2019

Xamarin Visual Studio – Error ADB0020 Android ABI mismatch

Following error message might pop-up when you to run Xamarin app on Android:

Error ADB0020: Android ABI mismatch. You are deploying an app supporting ‘armeabi-v7a’ ABIs to an incompatible device of ABI ‘x86’. You should either create an emulator matching one of your app’s ABIs or add ‘x86’ to the list of ABIs your app builds for.

Here is how you can resolve it.

In Solution Explorer select your project.

Right-click and select Properties or press Alt+Enter.

Select Android Options, scroll down. In right bottom corner click Advanced button.

From the drop down menu select desired architecture, e.g. x86_x64.

Note: After changing any checkbox it is necessary to wait a bit so that Visual Studio syncs the preferences.

Now you should be able to run the project.

Facebook Comments

4. August 2019

How to download invalid or self-signed HTTPS certificate without OpenSSL by using Google Chrome

When you need to acquire a public server certificate in PEM format from a web server and you do not have OpenSSL tools then you can use one “hidden” feature of Google Chrome.

Just open HTTPS URL in Google Chrome. You’ll see an error:

Your connection is not private.
NET::ERR_CERT_COMMON_NAME_INVALID

Do not click on Advanced or Reload.

Just click letters NET::ERR_CERT_COMMON_NAME_INVALID and PEM certificate will appear directly in the browser.

Now you can copy PEM encoded chain and paste it to your text editor.

Facebook Comments

24. July 2019

Creating Python virtualenv fails with error: Could not find a suitable TLS CA

You can create Python virtualenv using command:

virtualenv -p /usr/bin/python3 py-env3

You may encounter following strange error:

  Collecting setuptools
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels
...
OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /etc/ssl/certs/ca-certificates.crt
...
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 145, in apport_excepthook
    os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_virtualenv.1000.crash'

The error message is not very clear. Problem is caused by ca-certificates and it could be fixed by command:

sudo update-ca-certificates
Facebook Comments