JRehkemper.de

JRehkemper.de

- Homepage and Wiki of Jannik Rehkemper -

New Posts

Go Snippets

Define Variables mynumber := 1 mystring := "string" var emptyint int var emptystringarr []string var sum int = 2 Conversions Convert to String mystring := string(var) Convert to Integer number, err := strconv.Atoi(mystring) Loops For Each Loop for index, element := range myarr { } Loop Over Database Rows for routes.Next() { var link string routes.Scan(&link) CheckRoute(link) } Read File In one String func readFileAsString(filename) string { dat, err := os.

K3S - Use private Regestries

If you want to use private Image-Registries or mirrors to cache your images, you need to specify them in the registries.yaml file on all K3S Nodes. Insecure Registry If you want to access your registry over http and instead of https, you have to specify the url as an insecure registry. That way You can pull and push images with an error. You have to create a registries.yaml file on all you K3S nodes.

Monitor Network Stats with sar

The System Actvity Report or sar for short, can be used to track all kinds of system-metrics. Installation sar is part of the sysstat package and can probably be installed with your distributions packagemanager. [tux@server]$ sudo dnf install sysstat [tux@server]$ sudo apt install sysstat Samples and Intervals sar operates by measuring stats over a certain interval and aggregating them afterwards. Because of that we should always define the interval for every sample and how many samples we want.

Mount CIFS or SMB Share on Linux

Linux can not only mount NFS Share but CIFS / SMB shares from Windows environments as well. Provided you have the right helper tools installed. Install Helper-Tools RHEL On RHEL-based systems they are called cifs-utils. [tux@server]$ sudo dnf install cifs-utils Debian On Debian they are called cifs-utils. [tux@server]$ sudo apt install cifs-utils Mount share temporary While NFS authenticates the client by the hostname, CIFS uses credentials. Therefor you need to provide the credentials either via command-line or in a credentials-file.

Setup NFS Server on RHEL

If you need to share files between multiple servers, the easiest way is to setup a nfs-server. Install Packages First you need to install the necessary packages on the server, you want to host the share on. [tux@server]$ sudo dnf install nfs-utils Configure Exports The next step is to define which folders will be available for which client. This is done in the configuration file /etc/exports. The structure of this file is