This article documents my attempts to upgrade systemd and switch cgroupv2 on a Centos 7 system.
Background In linux 4.5, cgroup v2 has been added to the kernel code as a new feature. After upgrading the kernel, users can check if cgroup v2 is supported by the following command.
1 2 3 4 5 grep cgroup /proc/filesystems # OUTPUT nodev cgroup nodev cgroup2 The kubernetes 1.25.0 release has full support for cgroup v2, and the official documentation recommends that you configure cgroupDriver to systemd.
Kubernetes Ops: Taints and Tolerations
Taints and Tolerations in Kubernetes are one of the important mechanisms of the scheduling system, which manages services to ensure that Pods are not scheduled to inappropriate nodes.
In this article, we will briefly introduce the Taints and Tolerations mechanism of Kubernetes.
Taints Taints are labels defined on Node objects in Kubernetes. Unlike Labels and Annotations mechanisms that record information using key=values, Taints add an effect attribute that is described using the key=value:effect format, where the Key and Value can be user-defined strings, and the effect indicates how the Taints affects the Kubernetes scheduling pod, which currently supports the following three types.
A thread-safe map library with generic support
orcaman/concurrent-map is a very efficient thread-safe map library. As its documentation says, the standard library sync.Map is more suitable for append-only scenarios or a scenario where there is a lot less writing and a lot more reading. For more reads and more writes, concurrent-map may be more advantageous. It is a way to reduce the granularity of locks by slicing, thus improving performance.
Earlier this year, this library was revamped and started supporting generic types, but unfortunately, it only supports Value value generic, its key can only be of type string, which limits its application scenarios.
Kubernetes Service
Service Overview In kubernetes, a pod is a carrier for an application and the application can be accessed through the ip of the pod. However, the ip address of the pod is not fixed, which means it is not convenient to directly adopt the ip of the pod to access the service. To solve this problem, kubernetes provides Service resources, which aggregate multiple pods providing the same service and provide a unified entry address.
Using Linkerd in Production
So far, we have been using Linkerd in its most basic form without focusing on production-level related issues. In this section we will look at some of the key considerations for use in a production environment, including High Availability (HA) mode, Helm Chart, cross-cluster communication, and external Prometheus.
High Availability High Availability describes a system with a redundant architecture that will continue to operate if some part of the system fails.
Magical Google Binary Codec Technology: Protobuf
A very basic problem in computer network programming: how to represent the data interacted between client and server, think about this problem before reading on.
Consensus and Protocols The problem is not as simple as it seems, because the client process and the server process are running on different machines, which may run on different processor platforms, may run on different operating systems, may be written in different programming languages, how does the server recognize what data the client is sending?
File System in Golang: io.FS
There is an amazing thing about Go in the file IO scenario. When opening a file, instead of an interface, it returns a pointer to an os.File structure.
1 2 3 func Open(name string) (*File, error) { return OpenFile(name, O_RDONLY, 0) } This means that the concept of Go’s filesystem is directly related to the concept of the OS’s filesystem. You have to pass in a file path, and you have to actually go and open an OS file.
Pod Controller Detail
Pod Controller Overview Introduction Pods are the smallest management unit of kubernetes. In kubernetes, pods can be divided into two categories according to how they are created.
Autonomous pods: Pods created directly by kubernetes. Such pods are not available after deletion and will not be rebuilt Controller-created pods: Pods created by kubernetes through the controller, which are automatically rebuilt after deletion. Controller Pod controller is the middle layer for managing pods.
Nginx-based load balancing
Introduction to Nginx Nginx is an open source software originally designed as a high-performance web server. Today, Nginx can perform a number of other tasks, including caching servers, reverse proxy servers, load balancers, and more.
WEB SERVER At present, the mainstream use of web server software, mainly apache, nginx, tomcat, iis, etc., on a global scale, Apache is the most popular existing web server, but the most popular web server in the high-traffic website is indeed nginx, in our country, whether large or small Internet companies, the mainstream choice is also nginx as web server software.
Some concepts about asynchronous programming
When talking about asynchronous programming always involves various concepts, such as process, thread, parallel, concurrency, coroutine, just started to learn programming has been unable to understand the difference between these concepts, only know according to the document write write demo, now after learning the operating system gradually on these concepts to understand some clear, so write this blog to record a little.
1. Concurrent A logical flow whose execution overlaps in time with another flow is called a concurrent flow, and the two flows are said to run concurrently.
Build a mail server with Postal
I recently built a mail server with Postal and had a better experience than I expected, so I can’t wait to share my experience.
Why build a mail server Sending emails is a common requirement for web services, such as account verification, password reset and so on. Generally it is recommended to use a third-party mail service, as self-built mail servers are not reputable enough to be easily judged as spam.
Circumventing HTTPS Restrictions in Android Development
After targetSDK upgrade to 28, Android forces network requests to use https protocol. On the public server, it’s easy to do, just enable https support. And there is no website that doesn’t support https now, right?
However, this limitation is not so convenient when developing and debugging Android programs on your own computer. Probably Google has taken this into account and provided a method.
First open the local server, assuming it is running on port 3000.
Selenium Grid build and use
The main components of Selenium testing are: Test Code, WebDriver, Grid (Selenium Server, not required), Browser Driver and Browser. When we finish writing Selenium test cases for local debugging, the WebDriver interacts directly with the browser through the browser driver. At this point, the WebDriver, the browser driver, and the browser are located on the same host. This most basic interaction is shown in the figure below. When the local
Load balancing technology: HAProxy
Introduction to HAProxy HAProxy is a proxy software that provides high availability, load balancing and proxy software for TCP (Layer 4) and HTTP (Layer 7) based applications, HAProxy is completely free and provides fast and reliable proxy solutions for TCP and HTTP based applications with the help of HAProxy. HAProxy stability is also very good, comparable to hardware-grade F5, according to the official documentation, HAProxy can run at 10 Gbps - New benchmark of HAProxy at 10 Gbps using Myricom’s 10GbE NICs (Myri- 10G PCI-Express), a value that is quite impressive for a software-level load balancer.
Load Balancing Technology: DNS Polling
Usually we say that a domain name is uniquely corresponded to an IP address, we enter a domain name in the browser, then the request is passed to the DNS server, the DNS server resolves this corresponding IP and returns it to the browser. However, in some cases, a domain name can correspond to multiple IP addresses, and this is called DNS polling. Through DNS polling, we can achieve some goals that are difficult to achieve under normal circumstances.
How to build a DNS service
What is a DNS server? DNS, or Domain Name System, is a basic service in computer networks. Generally speaking, there are two ways to access a host on the network: by host name, or by IP address. In the Internet, using an IP address to communicate with a server simply does not work for the following reasons. IP addresses are not easy to remember IP addresses change frequently, so accessing
How can I manage Kubernetes applications without writing YAML?
Kubernetes abstracts everything within its own boundaries as resources. The main part of this is the workload workload controller, represented by Deployment and StatefulSet, and all other resources work around these main resources. Combined, these resources present a workload-centric model for IT technologists.
All resources in Kubernetes are described in declarative configuration files, which are defined by Yaml fields, giving IT technicians the greatest freedom while also placing high demands on their skills.
Golang Dynamic Script Research
1. Technical background 1.1 Dynamic linking technology for programs In the actual development process, we often need to dynamically update the functions of the program, or add or update the program modules without changing the main program files.
1.1.1 Dynamic Link Library The first and most common is the Dynamic Link Library (DLL) supported by the Windows platform, usually with the suffix .dll. Its advantages are very obvious:
multiple programs can share code and data.
C++ Simple Dependency Injection
1 Preface Some time ago, I was looking at the code of an old product, which was a mixed C/C++ code, and the code was full of global variables and used extern references to external global variables. The problem was that since there were dependencies between classes, if all dependencies were passed in through the constructor method, it would lead to a complex construction of the whole object dependency graph. For older code, using global variables + extern references can be a simple and brutal way to insert new call relationships to be added, but it also brings code corruption.
Configure different git configs for different directories
When using git on a daily basis, there is usually a global configuration file .gitconfig that all repo’s will use by default. If you need to configure a particular repo, you just need to modify the .git/config file in the repo. However, if you need to change more repo’s, it’s easy to forget and commit the wrong author’s commit.
Demo For example, if you want to use different user.name and user.