/images/avatar.png

Go Module, Package, Import

Module Module is a collection of packages. It is better to use the module name in Domain/Module format. The module naming convention is lowercase and single-word. It should be declared in the top of go.mod file. 1 2 3 module cozyfex.com/sample1 go 1.20 GOPATH It is recommended that the package name of Root Path of the module be the same as Module. Package The package name is the directory’s name that the file exist.

Go GOPATH

Setting GOPATH The GOPATH is where external modules installed with go get are stored. GOPATH In GoLand, you can set GOAPTH for each modules in Settings > Go > GOPATH.

Kubernetes Delete Binary of Node

Check Running Process by Port 1 netstat -plnt | grep 6666 1 tcp6 0 0 :::6666 :::* LISTEN 9591/system-atm Find Process by Port 1 lsof -i :6666 1 2 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME system-at 9591 root 3u IPv6 47760 0t0 TCP *:6666 (LISTEN) Find Out the Binary Path by Process ID 1 ls -lh /proc/9591/exe 1 lrwxrwxrwx 1 root root 0 Sep 26 16:10 /proc/9591/exe -> /bin/system-atm Kill the Process 1 kill -9 9591 Delete the Binary 1 rm /bin/system-atm

Kubernetes Implement Own TLS Certificate For Ingress

Create TLS Secret 1 kubectl create secret tls tls-secret --key tls.key --cert tls.crt Ingress 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: generation: 1 name: secure namespace: team-pink ... ... spec: tls: # add - hosts: # add - ingress.test # add secretName: tls-secret # add rules: - host: ingress.

Kubernetes Investigate Syscalls in Running Container

Find the Container 1 docker ps | grep collector1 1 3e07aee08a48 registry.killer.sh:5000/collector1 "./collector1-process" 14 seconds ago Up 13 seconds k8s_c_collector1-59ddbd6c7f-vvwgt_team-yellow_099822ad-2dfc-4963-bfc7-d806e00c0daf_0 Find the Process ID by the Container ID 1 ps aux | grep collector1-process Strace the Process 1 strace -p 10991 1 2 3 4 5 6 strace: Process 10991 attached restart_syscall(<... resuming interrupted futex ...>) = -1 ETIMEDOUT (Connection timed out) futex(0x4ad5d0, FUTEX_WAKE, 1) = 1 kill(666, SIGTERM) = -1 ESRCH (No such process) futex(0xc420030948, FUTEX_WAKE, 1) = 1 futex(0x4afe80, FUTEX_WAIT, 0, {tv_sec=0, tv_nsec=999998945}) = -1 ETIMEDOUT (Connection timed out)