Categories
linux

设置静态IP

一般通过命令nmtui设置

Categories
linux

linux 硬盘管理常用命令

dd

硬盘复制用命令 镜像复制命令

例子

sudo dd if=openwrt-image.img of=/dev/mmcblk0 bs=4M status=progress
复制当前目录下 openwrt-image.img 镜像  到/dev/mmcblk0 的硬盘

sudo dd if=/dev/mmcblk1 of=/dev/mmcblk0 bs=4M status=progress
将/dev/mmcblk1整个硬盘复制到/dev/mmcblk0  /dev/mmcblk0容量大于/dev/mmcblk1

sudo dd if=/dev/zero of=/dev/mmcblk0 bs=4M status=progress
清空控盘内容(全写0)

fdisk

管理查看硬盘分区信息

例子

sudo fdisk /dev/mmcblk0  
然后会进入硬盘命令行子命令交互空间

df

查看硬盘占用情况

df ./
展示当前目录所在硬盘分区占用情况

df -h
展示系统硬盘分区占用情况  包括挂载点信息

mount

挂载分区到某个挂载点

sudo mount /dev/mmcblk0p2 /mnt
其实一般当自动插入sd卡 或者USB就会自动挂载到这里
但是要改变挂载方式(可读可写) 就要先卸载在挂载

sudo mount -o rw /dev/mmcblk0p2 /mnt
增加-o rw 即为可读可写

umount

卸载分区

sudo umount /dev/mmcblk0p2

ln

这个命令可以为文件夹和文件设置硬链接和软连接

个人更加推崇软连接(硬链接是硬盘级别内部的连接 不能跨硬盘,软连接可以)

ln -s /path/to/source /path/to/destination

/etc/fstab

这个文件用来设置文件系统自动挂载

sudo blkid
列出系统所有分区的uuid

/etc/fstab 添加一行

UUID=1234-5678 /mnt ntfs rw 0 0

UUID=1234-5678:替换为你在步骤 1 中获取的 UUID。
/mnt:替换为你创建的挂载点。
ntfs:替换为你的文件系统类型(例如 ext4、ntfs 等)。
rw:默认挂载选项,包括 rw(读写)、suid、dev、exec、auto、nouser 和 async。
0 0:表示不进行备份和不进行文件系统检查。

Categories
K8S

K3S PVC local drive SD卡扩容

默认node 实体机器 PVC文件夹

/var/lib/kubelet/pods/<pod-uid>/volumes/kubernetes.io~csi/<pvc-name>/mount

可以通过 yaml 改变路径

apiVersion: v1
kind: PersistentVolume
metadata:
  name: example-pv
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  local:
    path: /mnt/data
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
                - your-node-name

通过 spec.local.path 设置指定路径

Categories
K8S

K3s 初始化

curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https://myserver:6443 K3S_TOKEN=mynodetoken sh

或者用我的 脚本install-agent 来安装

http://gitea.robinluo.top/robin/robin-k8s-yaml-script/src/branch/master/192.168.0.34

Categories
go

wxapkg 小程序源码反编译工具

我的fork link

https://github.com/RobinLJB/wxapkg

https://gitee.com/robinljb/wxapkg.git

http://gitea.robinluo.top/robin/wxapkg.git

基于go的微信小程序 反编译工具

有空可以自己尝试源码编译

PC 微信小程序目录

C:\Users\15699\Documents\WeChat Files\Applet\wxd7114bed517d1b84

Categories
K8S

安装Nexus3 后 部署docker仓库

  1. 导航到“仓库”部分。
  2. 点击“创建仓库”按钮,选择“docker (proxy)”或“docker (hosted)”类型。
  3. 根据你选择的类型配置仓库。
  4. 选择“docker (hosted)”,则可以管理本地Docker镜像。

具体配置页面截图

开启http服务 多开通8082 作为docker 仓库服务端口(only http) 内置的https 会有证书问题

nexus 添加 docker 账号密码校验 Realms (可以允许docker login)

Categories
K8S

K3S 安装 nexus3

amd64 拉取 sonatype/nexus

arm64 拉取 klo2k/nexus3

镜像默认开放8081 挂载目录/nexus-data

默认 admin密码 在容器内部 cat nexus-data/admin.password

Categories
K8S

K3S 常用命令

K3S token

NAME:
   k3s token - Manage bootstrap tokens

USAGE:
   k3s token command [command options] [arguments...]

COMMANDS:
   create    Create bootstrap tokens on the server
   delete    Delete bootstrap tokens on the server
   generate  Generate and print a bootstrap token, but do not create it on the server
   list      List bootstrap tokens on the server

OPTIONS:
   --help, -h  show help
Categories
openwrt

openwrt 包管理系统

opkg 是 openwrt 的包管理系统 对标与 APT 在ubuntu\debian

opkg 配置文件 /etc/opkg.conf

Categories
docker K8S

K3S kubectl 常用命令

查看log    sudo k3s kubectl logs -f -n kubernetes-dashboard kubernetes-dashboard-758765f476-x8rc7

应用 yaml  sudo k3s kubectl apply -f XXX.yaml

查看所有资源 sudo k3s kubectl get all --all-name-spaces

删除命名空间 sudo k3s kubectl delete ns  XXXXX

进入容器命令行 sudo k3s kubectl exec -it nexus-deployment-87b59d446-ht7p4 -n nexus - /bin/bash

创建命名空间 sudo k3s kubectl create namespace logging