1. Create a Go Modules project Create a directory 1 2 mkdir go-test cd go-test Initialization package 1 2 3 4 5 go mod init gitlab.private.com/shaowenchen/go-test go: creating new go.mod: module gitlab.private.com/shaowenchen/go-test go: to add module requirements and sums: go mod tidy Add business code main.go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 package main import ( "github.com/gin-gonic/gin" ) func main() { r := gin.
Tekton pipelines under multiple clusters
1. The advantages of Tekton for multi-cluster builds With Kubernetes, Tekton is already very resilient and can support large scale builds. At the same time, the development task mainly uses Yaml and Shell, which extends the scope of Tekton for various scenarios. Above is a diagram of Tekton under multiple clusters. Why does Tekton need a multi-cluster execution pipeline? Variable Kubernetes clusters at any time. A single Kubernetes cluster cannot
Tekton Based Cicd Platform
1. Background 1.1 Problems currently encountered with Jenkins Unstable orchestration engine Jenkins is an orchestration engine written in Java that stops The World (STW) on Full GC. During large builds, STW can cause Jenkins to be unable to process new requests.
Large builds stall Jenkins uses disk files to store data, and each pipeline, each build, takes up a file directory and generates a large number of files. Usually the number of pipelines is limited, but when builds reach the 10,000+ level, the impact of IO on Jenkins can be felt.
Gateway Services under Kubernetes - APISIX
1. A comparison of several common gateways Nginx, modular reverse proxy software, developed in C OpenResty, a Nginx-based web development platform that parses and executes Lua scripts Kong, an application of OpenResty, is an API gateway with API management and request proxy functions, using PostgreSQL storage APISIX, which replaces Kong’s PostgreSQL for Etcd, based on Nginx’s core library implementation The advantage of APISIX is that it provides API management and extension capabilities, allowing the gateway to be configured and customized instead of just forwarding services.
Monitor of Kubernetes Using Prometheus Grafana
The Prometheus community is updating so fast that some of the documentation written before is a bit out of date. Recently, I started to focus on observability again, and make up for some knowledge points in operation and maintenance.
1. Explanation of terms Grafana A visualization tool that provides various visualization panels and supports various data sources, including Prometheus, OpenTSDB, MySQL, etc.
Prometheus A time series database, mainly used to collect, store, and provide query data to the public.
How to add an entrance to Kubernetes Apiserver.
1. How to access the remote cluster locally During development, you need to connect to the remote Kubernetes cluster directly. The usual practice is to copy /etc/kubernetes/admin.conf to the local ~/.kube/kubeconfig.
But the server address for kubeconfig is kubernetes.default.svc. Therefore, we need to configure a hosts.
1 1.1.1.1 kubernetes.default.svc If you need to switch between clusters, not only do you need to change kubeconfig, but you also need to modify the hosts.
Multi-cluster applications under Kubevela
Kubevela is currently at version 1.1. In general, we consider version 1.x to be relatively stable enough to try to introduce into production. As we continue to track and learn, we’ve learned some good things about Kubevela, and this is a short summary document.
1. What Kubevela can solve For platform developers Several roles need to be distinguished: development, operations and maintenance, and operations and maintenance development. Development is oriented to business needs, Ops is oriented to business stability, and Ops development is oriented to efficiency.
Time and Time Zone in Go
1. Time and Time Zone 1.1 Time standard UTC, Universal Time, is the current standard of time and is measured in atomic time.
GMT, Greenwich Mean Time, is the former time standard, which specifies that the sun passes the Royal Greenwich Observatory in the suburbs of London, England, at 12:00 noon each day.
UTC time is more accurate, but if accuracy is not required, the two standards can be considered equivalent.
New VS Code bug: crazy creation of junk files + automatic modification of user files
Recently, user na-an discovered that when opening a folder with Microsoft’s VSCode editor, many empty files with invalid code are automatically created in the directory. The user then posted a related issue to the VSCode GitHub repository, which randomly sparked a lively discussion, with many users saying they were also suffering from the bug.
Some of the file names are short, some are long, and the names of these files are not valid unicode, for example \312\316\361 in the figure is octal.
Conditional compilation using if constexpr
In project development, we usually use conditional compilation to trim code and selectively exclude code that is not needed, for example, if a feature is not supported at all under a certain platform, then that feature should not be compiled. Generally we use macros to determine the code, selectively pick the parts that need to be compiled, and turn on such conditions in the build system. 1 2 3 4
Prometheus Routing and Routing Configuration with Nginx Reverse Proxy
Background The company group an end-to-end containerized test environment, located under different sub-paths, proxied by Nginx: * For example, user A is under /a/prometheus/: /a/prometheus/. For example, user A is under /a/: /a/prometheus/ For example, user B under /b/: /b/prometheus/ The effect you want to achieve, in addition to the above distinction between different subpaths, requires that there is no such distinction inside the container: i.e., the container can be
Develop and debug envoy with vscode Container
As I am recently studying envoy project, which is a cpp project, for me this cpp newcomer is still more pressure, feel everywhere is a pit, open a guide article to record. If you want to study the envoy project source code, it is definitely necessary to jump to the code, but if you open it with clion, then you will find that envoy is built with bazel, no CMakeLists.txt
Common commands for cleaning up Kubernetes cluster resources
Long-running clusters often face a variety of resource exhaustion problems, in addition to insufficient disk Kubelet will also actively clean up the image to increase uncertainty, this article provides some command snippets for cleanup work.
1. Kubernetes Base Object Cleanup Clean up Pods in Evicted state 1 kubectl get pods --all-namespaces -o wide | grep Evicted | awk '{print $1,$2}' | xargs -L1 kubectl delete pod -n Clean up Pods in Error state 1 kubectl get pods --all-namespaces -o wide | grep Error | awk '{print $1,$2}' | xargs -L1 kubectl delete pod -n Clearing the Completed state of Pods 1 kubectl get pods --all-namespaces -o wide | grep Completed | awk '{print $1,$2}' | xargs -L1 kubectl delete pod -n Clean up unused PVs 1 kubectl describe -A pvc | grep -E "^Name:.
Reading Btrfs partition files on MacOS
1. Background and pre-requisites The Btrfs file system is a younger file system than Ext4, with more playable features such as support for snapshots, subvolumes, checksums and self-tests, soft RAID and even transparent compression.
However, it is recommended not to use Btrfs file system without O&M capability. This article documents the process of reading data after removing the disk from the Btrfs file system under a Synology DSM system.
In my DSM system, there are two hard disks forming a RAID1 array, using the Btrfs file system.
Several open source Kubernetes web-side management tools
Recently, I was investigating the open source Kubernetes management platform, and the requirement was to be able to manage hundreds of clusters on the intranet. The function is positioned to assist in operations and maintenance, providing capabilities to the application layer, rather than directly to the end user.
1. Kubernetes Dashboard Project address.
https://github.com/kubernetes/dashboard
Technology Stack: Angular + Go
Key words.
Single cluster K8s resource management 2. Kuboard Project address.
How to cache third-party dependencies in a phased build
In non-phased build scenarios, when using containers for builds, we can mount the cache directory in the container to the build host to perform the build task; then copy the product to the run image to make the application image. However, in a phased build, the build image and the run image are in the same Dockerfile, which makes it difficult to optimize the cache for third-party dependencies.
1. Create a Vue instance project Install the Vue CLI
Migrating Docker storage to a new drive
1. hard disk formatting View new disk
1 fdisk -l Usually, the name of the second hard disk will be /dev/sdb.
Disk partition
1 fdisk /dev/sdb There will be a prompt to enter the following parameters.
1 2 3 4 command (m for help):n Partition number(1-4):1 First cylinder (1-22800,default 1):Enter command (m for help):w Format the disk as ext4
1 mkfs.ext4 /dev/sdb Mount the disk to the specified directory
1 2 mkdir /data mount -t ext4 /dev/sdb /data Auto-mount directory on boot
Adding an external DNS service to a Kubernetes cluster
1. Add DNS to the host 1.1 CentOS Edit the resolve.conf file directly.
1 2 3 4 /etc/resolv.conf nameserver 114.114.114.114 nameserver 8.8.8.8 1.2 Ubuntu Since resolve.conf is automatically generated, you need to change resolved.conf to make it work.
1 2 3 4 5 vim /etc/systemd/resolved.conf [Resolve] DNS=114.114.114.114 DNS=8.8.8.8 Then restart the resolve service.
1 systemctl restart systemd-resolved.service Finally, you can also confirm that the configuration is in effect.
1 systemd-resolve --status 2.
Injecting Environment Variables and Priorities in Kubernetes Pods
1. Several ways for Kubernetes Pods to refer to environment variables 1.1 Direct Key/Value You can set the Value value directly, or you can use the current Pod’s information as the Value value.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 apiVersion: v1 kind: Pod metadata: name: envar-demo labels: purpose: demonstrate-envars spec: containers: - name: envar-demo-container image: gcr.
How to Upgrade a Kubernetes Cluster
The upgrade idea is to upgrade the control node first and then the working node after expelling the load and taking off the traffic.
1. View cluster version 1 2 3 4 kubectl version Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.4", GitCommit:"e87da0bd6e03ec3fea7933c4b5263d151aafd07c", GitTreeState:"clean", BuildDate:"2021-02-18T16:12:00Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.0", GitCommit:"c2b5237ccd9c0f1d600d3072634ca66cefdf272f", GitTreeState:"clean", BuildDate:"2021-08-04T17:57:25Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"} The current version is 1.22. Since kubeadm does not allow cross-version upgrades, we are going to upgrade to 1.