1. Causes kubectl exec -it podName -n namespace /bin/sh.
When I entered the container and ran the date command, I found that the time zone is not UTC time zone, so the company logging system cannot collect logs and needs to change to UTC+8.
2. Solution You need to change the Dockerfile to change the timezone when you build the image.
1 2 3 4 5 6 7 8 9 10 11 12 FROM alpine:3.
Wow to Build Buildx
1. buildx buildx is a plugin for docker. The docker buildx subcommand executes the buildx binary. This article analyzes how to compile buildx yourself.
2. Standard Build The official documentation provides the standard build method: https://github.com/docker/buildx#building
1 2 3 4 5 6 7 8 9 10 11 12 13 # Buildx 0.6+ $ docker buildx bake "https://github.com/docker/buildx.git" $ mkdir -p ~/.docker/cli-plugins $ mv ./bin/build/buildx ~/.docker/cli-plugins/docker-buildx # Docker 19.03+ $ DOCKER_BUILDKIT=1 docker build --platform=local -o .
Apache Activemq Artemis Quickstart
ActiveMQ Artemis Installation Download address: https://activemq.apache.org/components/artemis/download/
For this example, download the package “apache-artemis-2.28.0-bin.zip” and unzip it to any installation directory.
Configure the environment variable “ARTEMIS_HOME”, the value is the unpacked directory.
Creating a Broker Instance A Broker instance is a directory that contains all configuration and runtime data (such as logs and message logs) associated with the Broker process. It is recommended not to create the instance directory under ${ARTEMIS_HOME}.
Load Balancing Solution for Kubernetes: MetalLB
I. Product Description After Kubernetes deployment, we often need to open the service to external users to access . If you are using a cloud platform (e.g. AWS), this requirement is very simple to handle and can be achieved through the LoadBalancer of the cloud platform.
But with a self-built kubernetes bare-metal cluster, it is much more problematic. Bare metal clusters do not support load balancing by default, and the available solutions are no more than Ingress, NodePort, ExternalIPs, and other ways to achieve external access.
Using Falco to listen for runtime security
1. What is Falco Falco is a cloud-native runtime security-related project contributed to CNCF by Sysdig.
Falco implements a scalable event rule filtering engine that finds security issues in a system by fetching events, matching security rules, and generating alert notifications. The events come from system calls and also support ebpf probes, and the rules are open source and can be extended by your own definitions. The following diagram shows its architecture.
Js object array de-duplication
In the course of daily development, whether it’s data returned to us by an interface or data we create ourselves, we inevitably encounter cases where there are duplicates.
Two simple methods of object array de-duplication are described below.
Suppose we now have this array of arr objects as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 const arr = [ { id: "1", pId: "0", title: "A", }, { id: "2", pId: "0", title: "B", }, { id: "3", pId: "0", title: "C", }, { id: "3", pId: "0", title: "C", }, ] de-duplication through properties and methods of Es6 new Set() instances
Custom Blog Search - Integration with Meilisearch
MeiliSearch is a search engine written in Rust, and it is also open source. Since it’s written in Rust, I don’t have to tell you how stable it is, and Meilisearch includes all the search features you can think of. One of the reasons I chose it was because I only wanted to use its API and search capabilities, but I wanted to fully customize a whole set of UI and interactions etc.
WTF Go: Constants
1 2 3 4 5 6 7 8 9 10 11 12 13 import ( "time" "math/rand" ) // invalid operation: rand.Intn(10) * 1000 * time.Millisecond (mismatched types int and time.Duration) time.Sleep(rand.Intn(10) * 1000 * time.Millisecond) ❌ // 🤔 make sense. time.Sleep(time.Duration(rand.Intn(10) * 1000) * time.Millisecond) ✅ // wtf ?! time.Sleep(1000 * time.Millisecond) ✅ Look at this simple example above.
The first error is easy to understand: integers cannot be multiplied with time.
Knowledge about WebAssembly
What is WebAssembly? WebAssembly, or WASM for short, literally consists of Web and Assembly, which can be understood as web/browser assembly, indicating the origin of the technology, which is assembly code that runs inside a browser. However, as the technology has iterated, WebAssembly has long since moved beyond its original design vision.
WebAssembly is not exactly assembly language, but rather an assembly bytecode-like instruction format standard maintained by the W3C’s WASM Working Group and the ByteCode Alliance.
Rapid deployment of OpenStack single-node experimental environment using Packstack (RDO) in CentOS
Packstack is primarily a tool for rapid deployment of proof-of-concept (PoC) environments from Redhat.
Packstack is a command line tool that uses Python to encapsulate the Puppet module to deploy OpenStack on a server via SSH, using Packstack to quickly deploy a set of OpenStack environments. It is suitable for beginners to experience the features of OpenStack and get familiar with the basic OpenStack commands. However, since the technical details are hidden, you need to check the official OpenStack documentation carefully and then install each OpenStack component step by step manually to deepen your understanding of OpenStack.
C++ Static Reflection and Serialization
Recently, when using FlatBuffers as a serialization protocol for RPC, I encountered some problems.
the data types supported by FlatBuffers are limited, and specific data types need to be converted manually during serialization/deserialization. the TableType generated by the FlatBuffers code is not easy to use, and it is error-prone to call the Builder manually for construction. the performance of FlatBuffers code-generated NativeType is worrying, and the advantage of no deserialization is lost when using this type.
Users and Groups in the K8s RBAC system
In the K8s RBAC system, there are three types of authorization objects: User, Group, and ServiceAccount.
As a resource type of K8s, ServiceAccout has a specific API that can be operated. This article introduces User and Group, which have no specific resource definition and are relatively difficult to view.
Create User and Group 1. Issue X509 Client certificate If the certificate is issued by CA, apiserver auth logic will parse the subject object of the certificate and use common_name (CN) as User and organization (O) as Group.
Apache Kafka Installation and Usage
Download Kafka Download the installation package of Kafka from the official website, “kafka_2.13-3.4.0.tgz” is used in this article. Just unarchive it to the installation directory. Start with ZooKeeper or KRaft Note: Java 8+ must be installed in your local environment. Apache Kafka can be started using either ZooKeeper or KRaft. To get started with either configuration, follow the configuration below, but do not use both at the same time. ZooKeeper
Kubernetes Learning (K3d)
With the development of Kubernetes and its surrounding ecology, cloud-native technology is now very mature and popular, but the Kubernetes architecture is complex, the threshold for use is high, even if you learn to install a Kubernetes cluster is also a very troublesome thing. The good thing is that most cloud vendors provide ready-made container services that can be created and used directly, and there are also projects that simplify the simulation of Kubernetes, such as Kind, Minikube and K3d, which can be used by developers to learn and develop debugging locally.
Using Git Gracefully
Keep clear commit records Uniformly standardize commit messages Git forces commit to have a summary message, but there are no restrictions on the content. Take a look at the following commit history.
Randomly written
1 2 3 changed bug commit More explicit (django-oscar)
1 2 Use nodejs v14 for test builds. Read sandbox cache settings from CACHE_URL Normative (Vim)
1 2 3 4 5 6 7 8 9 10 patch 9.
Swift Package Plugin and Sandbox
Preface Apple introduced Swift Package Plugin, a new SPM feature, at WWDC 22 last year. With the Swift Package Plugin, developers can extend the menu items and build process in Xcode to customize and automate some of the development process.
We know that Apple deprecated the previously unconstrained third-party plugin mechanism in Xcode 8 with a new extension mechanism called Xcode Extensions. All extensions run in their own separate processes and cannot tamper with the behavior of the main Xcode program.
Yarn Workspace
Whenever you are ready to write a new project, have you ever thought about whether you need to manage the front and back-end code with different git repositories, or whether you need to split some relatively low-level code into a separate git repository, so that when the low-level code is stable, you can directly release it as a separate npm package for the project.
So wouldn’t this be a straightforward way to manage the project with a different git repository?
The creation of tag and release in git and the difference between the two
Definition A tag is a pointer to a specific commit, that is, each tag corresponds to a specific commit.
A release is a first-level object with changelogs and binaries that represents the history of a project up to a specific point in time beyond the Git schema itself. That is, with a release, you can not only represent the history of the project through the source code, but you can also describe the state of the project at that point through the compiled binaries.
Deploying iOS Flutter Development Environment
Download the latest installer from the Flutter SDK version list or just git clone.
1 git clone https://github.com/flutter/flutter.git -b stable Add the path to the downloaded and unpacked file to the environment variable. For example, on Linux and macOS Mojave and earlier systems, Bash Terminal is used by default, so you need to modify the $HOME/.bashrc file, while macOS Catalina systems use Z Shell by default, so you need to modify the $HOME/.
Solve the "error obtaining VCS status: exit status 128" problem when building in a container after upgrading Golang to version 1.18+
Intro Golang is an amazing language, its syntax is not very complicated, and the compiled program is a Binary, you don’t need to install any extra runtime to run, if you want to write a small program like Hello World, just follow the tutorial and you can write it quickly. If you want to write a slightly more complex Web application, just find a Web framework, such as Gin, Fiber, etc.