Develop cross-platform libraries with Kotlin Native

The cross-platform principle of Kotlin Native Kotlin Native’s cross-platform is pretty much all-inclusive. JVM JS Android / Android NDK Apple Linux Windows WebAssembly In short, although Kotlin can run on JVM and call Java code, Kotlin is not Java, and with the help of LLVM, Pure Kotlin Code can be compiled into With LLVM, Pure Kotlin Code can be compiled into platform code to achieve VM-less cross-platform. It can be

Resolve MySQL connection exception: 'caching_sha2_password' cannot be loaded

When I was developing my own project, I needed to use MySQL for unit testing, so I started a MySQL container locally using docker, imitating the way of go-txdb. When I executed the test, the following error occurred. 1 2 mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found Cause Analysis Conclusion: The local client version is too low and does not support the server-side version of the authentication method.

Docker Compose Explained

When we want to start a series of interdependent services at the same time, it is particularly tedious to start them one by one and in strict order. This is where we can use docker compose to perform this series of operations. Compose Compose is a tool for defining and running multi-container Docker applications. With Compose you can use a YML file to configure all the services your application needs, and then create and start all the services from the YML file configuration with a single command.

Linux nslookup command

We often check the DNS information of an IP or domain name at work to see which machine the current IP is bound to, or if the current domain name resolves properly. This is where the nslookup command comes into play. Command Details The nslookup command is mainly used to query the DNS information of a domain name. nslookup has two working modes: “interactive mode” and “non-interactive mode”. Enter nslookup directly in the command line, and you will enter the interactive mode without entering any parameters.

Cilium Masquerading Troubleshooting

Background When upgrading cilium v1.8.1 to v1.11.1, the business pod reported a mysql authorization error, and after checking, we found that the clientIP of mysql server is the nodeIP of the business pod, not the default podIP, because mysql server only authorized the current K8s cluster The mysql server only authorizes the pod cidr of the current K8s cluster, so it reports an authorization error. The contradiction is that when using cilium v1.

Side effects of nodePort

Problem phenomenon One day I encountered a problem: when accessing a web service, some requests failed, and Connection Refused was returned. For some reason, the web service is a hostNetwork type, which is the same network namespace as the host, and when I logged into Node, I could see that the listening socket was still there, but when I made a direct curl request, it returned Connection Refused. Why? Usually Connection Refused means that the listening socket is not open and the corresponding port number is not opened, the kernel will return icmp-port-unreachable, but now it is obvious that the port is open.

Is Golang's empty array nil?

When reading kubernetes code, sometimes you will see some code compares arrays to nil. 1 2 3 4 5 6 7 8 9 // bindAPIUpdate gets the cached bindings and PVCs to provision in podBindingCache // and makes the API update for those PVs/PVCs. func (b *volumeBinder) bindAPIUpdate(podName string, bindings []*bindingInfo, claimsToProvision []*v1.PersistentVolumeClaim) error { if bindings == nil { return fmt.Errorf("failed to get cached bindings for pod %q", podName) } if claimsToProvision == nil { return fmt.

Tracing nginx ingress maximum open file count issue

Problem phenomenon Our kubernetes ingress controller is using ingress-nginx from kubernetes and we recently encountered a " Too many open files" problem. 1 2 3 2019/09/19 09:47:56 [warn] 26281#26281: *97238945 a client request body is buffered to a temporary file /var/lib/nginx/body/0000269456, client: 1.1.1.1, server: xxx.ieevee.com, request: "POST /api/v1/xxx HTTP/1.1", host: "xxx.ieevee.com" 2019/09/19 09:47:56 [crit] 26281#26281: accept4() failed (24: Too many open files) 2019/09/19 09:47:56 [crit] 26281#26281: *97238948 open() "/var/lib/nginx/body/0000269457" failed

The disappearing Prometheus indicator

Problem phenomenon We have some GPU machines and need to count GPU related information, the data is taken from Prometheus, but one day we suddenly found that some labels of some GPU node metrics are empty. Here are the metrics of normal nodes. 1 container_accelerator_duty_cycle{acc_id="GPU-d8384090-81d2-eda5-ed02-8137eb037460",container_name="nvidia-device-plugin-ctr",endpoint="https-metrics",id="/kubepods/besteffort/podd917e00f-a779-11e9-b971-6805ca7f5b2a/38a5decf96e9f007fcb0059d79017ea3b3c29ff4c9a81b7fec86cf63c06baf53",image="sha256:7354b8a316796fba0463a68da79d79eb654d741241ca3c4f62a1ef24d8e11718",instance="10.0.0.1:10250",job="kubelet",make="nvidia",model="Tesla P40",name="k8s_nvidia-device-plugin-ctr_nvidia-device-plugin-daemonset-sn2cg_lambda_d917e00f-a779-11e9-b971-6805ca7f5b2a_1",namespace="ieevee",node="x1.ieevee.com",pod_name="nvidia-device-plugin-daemonset-sn2cg",service="kubelet"} 0 Here are the metrics of the exception node. 1 container_accelerator_duty_cycle{acc_id="GPU-a7b535d0-d6ca-022c-5b23-1bff863646a4",container_name="",endpoint="https-metrics",id="/kubepods/besteffort/pod8bb25662-de9a-11e9-84e7-f8f21e04010c/cde3858becb05366e71f230e876204be586662f274dcb4a6e2b75ea404f2d5a9",instance="10.0.0.2:10250",job="kubelet",make="nvidia",model="Tesla V100-PCIE-16GB",name="",namespace="",pod_name=""} You can see that the data taken out by Prometheus, the container_name, name, namespace, and pod_name in the label are all empty.

Setting up the shared memory of a kubernetes Pod

Problem description Users can use shared memory to do some for communication (vs golang’s “Shared memory by communication”). On a kvm or physical machine, the size of shared memory available to the user is about half of the total memory. Below is the shared memory on my pve machine, /dev/shm is the size of the shared memory. 1 2 3 4 5 6 7 8 root@pve:~# free -h total used free shared buff/cache available Mem: 47Gi 33Gi 3.