u0u0 发布的文章

安装lftools

$ sudo apt install python3-pip
$ sudo python3 -m pip install -U pip
$ sudo python3 -m pip install -U setuptools
$ sudo -H pip3 install --ignore-installed PyYAML
$ sudo pip3 install lftools

配置

$ vim ~/.netrc
machine nexus.akraino.org
login <LF ID>
password <Password>

上传CD log

$ vim push_logs.sh
# Deploying logs to LF Nexus log server ##
# BUILD_NUMBER and JOB_NAME should be set by Jenkins

NEXUS_URL=https://nexus.akraino.org
SILO=myais
JENKINS_HOSTNAME=https://52.83.xx.xxx/
JOB_NAME=smartcities
BUILD_NUMBER=8
BUILD_URL="${JENKINS_HOSTNAME}/job/${JOB_NAME}/${BUILD_NUMBER}/"
NEXUS_PATH="${SILO}/job/${JOB_NAME}/${BUILD_NUMBER}"

lftools deploy logs $NEXUS_URL $NEXUS_PATH $BUILD_URL

echo "Logs uploaded to $NEXUS_URL/content/sites/logs/$NEXUS_PATH"

上传BluVal Results

$ zip -r results.zip ./results
NEXUS_PATH="/pcei/job/v2"
NEXUS_URL="https://nexus.akraino.org/"
lftools deploy nexus-zip $NEXUS_URL logs $NEXUS_PATH results.zip

错误新如下:

Configure Gradle memory settings using '-Xmx' JVM option (e.g. '-Xmx2048m'.)

全局设置下Android Studio的内存。

Settings ==> Appearance & Behavior ==> System Settings ==> Memory Settings.
三个内存设置都调大为2048M

查看k3s anget启动日志,有如下错误。

$ systemctl status k3s-agent.service

`time="2022-04-09T05:03:40+08:00" level=error msg="CA cert validation failed: Get \"https://127.0.0.1:6444/cacerts\": x509: certificate has expired or is not yet valid: current time 2022-04-09T05:`

表面上看是请求到的server证书,时间早于证书的notBefore time,分析原因可能是两个系统的时区和时间不一致导致。

统一到utc时区,并自动更新时间

$ timedatectl set-timezone UTC
$ timedatectl set-ntp yes

然后需要重新安装k3s server, 之前agnet就能正常连接到server了

默认运行容器的时候,网络是一个隔离的子网络,不能通过localhost访问宿主机的端口

docker 官方从18版本开始提供host.docker.internal访问宿主机,但默认只能Mac和Windows使用。
Linux 从20.04版本开始支持通过添加运行参数的方式来支持.

--add-host=host.docker.internal:host-gateway

如果是老版本可以用下面的参数来让容器和宿主机出于同一个网络中。

--net="host"

SONiC 配置管理口的ip地址

  1. 查询已存在的设置

    $ redis-cli -n 4 keys "MGMT_INTERFACE*"
  2. 如果已有设置就删除

    $ redis-cli -n 4 DEL "MGMT_INTERFACE|eth0|10.20.30.40/24"
  3. 编辑配置文件

    $ vim mgmt_ip.json
    {
            "MGMT_INTERFACE": {
                    "eth0|192.168.0.116/24": {
                            "gwaddr": "192.168.0.1"
                    }
            }
    }
  4. 加载配置文件,并保存

    $ sudo config load mgmt_ip.json
    $ redis-cli -n 4 save
    $ redis-cli save
    $ sudo config save
  5. 重启网络

    $ sudo systemctl restart interfaces-config
  6. 检查配置

    $ /sbin/ifconfig eth0

参考:https://github.com/Azure/SONiC/blob/master/doc/SONiC-User-Manual.md

  1. 下载离线包
    在官方release地址下载k3s和k3s-airgap-images-xxx.tar.gz, 在 https://get.k3s.io 下载 k3s_install.sh 脚本
  2. 安装依赖包

    sudo apt-get update
    sudo apt-get install nfs-common
  3. 离线安装

    sudo cp ./k3s /usr/local/bin/
    sudo chmod +x /usr/local/bin/k3s
    
    sudo mkdir -p /var/lib/rancher/k3s/agent/images/
    sudo cp ./k3s-airgap-images-arm64.tar.gz /var/lib/rancher/k3s/agent/images/
    
    sudo chmod +x ./k3s_install.sh

Server docker模式

sudo INSTALL_K3S_SKIP_DOWNLOAD=true ./k3s_install.sh --docker

确保每一个node,加入集群自动运行DaemonSet

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: node-daemon
  labels:
    app: node-daemon
spec:
  selector:
    matchLabels:
      name: node-daemon
  template:
    metadata:
      labels:
        name: node-daemon
    spec:
      containers:
        - name: parsec-client
          image: parsec-client:v1.0
          ports:
            - containerPort: 8300
              hostPort: 8300
          volumeMounts:
            - mountPath: /run/parsec
              name: parsec-run
      volumes:
        - hostPath:
            path: /home/parsec/run
          name: parsec-run

等价于docker命令

sudo docker run --rm -d -p8300:8300 -v /home/parsec/run:/run/parsec parsec-client:v1.0

A机器导出

$ sudo docker save aef2a010b6b5 > parsec-client-v1.0-docker.tar

B机器导入

$ sudo docker load < parsec-client-v1.0-docker.tar

查看image id

$ sudo docker images
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
<none>       <none>    aef2a010b6b5   47 hours ago   17.3MB

根据image id设置tag

$ sudo docker tag aef2a010b6b5 parsec-client:v1.0
$ sudo docker images
REPOSITORY      TAG       IMAGE ID       CREATED        SIZE
parsec-client   v1.0      aef2a010b6b5   47 hours ago   17.3MB