Pinning CPUs in Kubernetes using full-pcpus-only with eksctl

Posted on Mon 16 May 2022 in kubernetes, eksctl • Tagged with kubernetes, eksctl

I was trying to use the option full-pcpus-only with eksctl and I was not having luck. In the end, I was able to do it by using this cluster.yaml configuration file:

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: k8s-Stokholm-Cluster
  region: eu-north-1

nodeGroups:
  - name: ng-1
    instanceType: c5.4xlarge
    desiredCapacity: 1
    ssh:
      publicKeyPath: /home/joaquin/k8s/joaquin-k8s-stockholm.pub
    kubeletExtraConfig:
      cpuManagerPolicy: static
      cpuManagerPolicyOptions:
        full-pcpus-only: "true"
      kubeReserved:
        cpu: "300m"
        memory: "300Mi"
        ephemeral-storage: "1Gi"
      kubeReservedCgroup: "/kube-reserved"
      systemReserved:
        cpu: "300m"
        memory: "300Mi"
        ephemeral-storage: "1Gi"
      featureGates:
        CPUManager: true
        CPUManagerPolicyOptions: true

When my file had not the correct options, the problem I was seeing was that eksctl got stuck with the message:

waiting for at least 1 node(s) to become ready in "ng-1"

For debugging the errors, I connected by ssh to the EC2 instance that was created and I check the logs of the kubelet service with this command:

journalctl -u kubelet.service

In order to have the CPUs pinned to a physical CPU, I had to make the requests and the limits equal (both for CPU and memory …


Continue reading

Error cannot use path@version syntax in GOPATH mode

Posted on Wed 15 December 2021 in go • Tagged with go

I was trying to install xk6 using this command:

go install go.k6.io/xk6/cmd/xk6@latest

And I got this error:

package go.k6.io/xk6/cmd/xk6@latest: cannot use path@version syntax in GOPATH mode

Although I found a question in Stack Overflow with that error, the given solutions didn't work for me. In the end, I learned that the message was caused because I was using an old version of Go: the path@version was added in Go 1.16 and I was using 1.15. Thus, the solution for my problem was updating Go.


Reading traces from a file in k6

Posted on Wed 24 November 2021 in k6 • Tagged with k6, kubernetes

I wanted to read a trace of requests per second I have in a file and use it as the injection pattern in k6. I could do it by reading the values into an array, which is then used as the stages in a ramping arrival rate excutor, like this:

import http from 'k6/http';
import papaparse from 'https://jslib.k6.io/papaparse/5.1.1/index.js';
import { SharedArray } from 'k6/data';

const trace_file = 'PATH_TO_THE_TRACE_FILE';
const trace = new SharedArray('another data name', function () {
  return papaparse.parse(open(trace_file)).data;
});

var stages = []
for (var i of trace) {
  stages.push({ target: trace[i][0], duration: "1s" })
}

export const options = {
  discardResponseBodies: true,
  scenarios: {
    contacts: {
      executor: 'ramping-arrival-rate',
      startRate: 1,
      timeUnit: '1s',
      preAllocatedVUs: 50,
      maxVUs: 1000,
      stages: stages
    },
  },
};

export default function () {
  const url = "http://localhost:8555";
  http.get(url);
}

Configuring Ubuntu Server 20.04 LTS gateway

Posted on Wed 20 October 2021 in Ubuntu • Tagged with Ubuntu

The current version of Ubuntu Server 20.04 LTS uses netplan in order to configure the network. If it doesn't use cloud-init to provision the network, the network configuration will be in a YAML file in /etc/netplan. There you can change the network parameters, such as the default gateway if you have a fixed connection.

After changing them, run this command to apply them (remember that you may disconnect from the network, so don't run it from a remote connection!):

sudo netplan apply

A more detailed explanation can be found in this very helpful post at linuxize.


Upgrading to dash 2.0

Posted on Tue 05 October 2021 in Python • Tagged with Python, Dash

I had some dashboards built in Python with Dash. They were using version 1.13.4 and I updated it to version 2.0.0. In addition to converting the imports, as explained in the migration guide, I also had to change state variables because I was getting the error:

ValueError: The state keyword argument may not be provided without the input keyword argument

I didn't understand the explanation in the migration guide. After reading the new documentation about callbacks, I've found that I had to change my app_callbacks. Previously, I had something like this:

@app.callback(
    Output(component_id='wl-plot', component_property='src'),
    [
        Input(component_id='sol-select', component_property='value'),
        Input(component_id='button-apply', component_property='n_clicks'),
    ],
    state=
    [
        State(component_id='base-dir', component_property='value'),
    ]
)

And I had to change it to this:

@app.callback(
    Output(component_id='wl-plot', component_property='src'),
    Input(component_id='sol-select', component_property='value'),
    Input(component_id='button-apply', component_property='n_clicks'),
    State(component_id='base-dir', component_property='value'),
)

So, basically, now you only have a list of Output, Input and State instances and you don need the state=....