? k8s ?    2020-03-05 17:02:47    1458    0    0

前提

 

基于ubuntu 18.4 已经搭建了一套简单的k8s 集群
kubectl,docker 服务能正常停启

基本环境

lcf@vm1:~/k8s$ kubectl get nodes
NAME   STATUS   ROLES    AGE   VERSION
vm1    Ready    master   5d    v1.12.5
vm2    Ready    <none>   5d    v1.12.5​

master:vm1
node1:vm2

查看本集群中的node

tips : 查看各种对象列表: kubectl get nodes/svc/pods, 默认-n 是 namespace=default , 如果查找不到,可-n 更详细的namespace

 

部署一个最简单的测试应用nginx

创建一个部署和服务

kubectl create deployment nginx --image=nginx
kubectl create service nodeport nginx --tcp 80:80​


创建成功后可查看执行中的pod

lcf@vm1:~/Tekton$ kubectl get pods
NAME                    READY   STATUS    RESTARTS   AGE
nginx-55bd7c9fd-94tj5   1/1     Running   0          4h33m​


注: 使用--image=nginx 默认是从docker mirror 中pull 镜像,会默认从国外镜像pull , 如果pull 失败时,看到的pod 的状态为:ImagePullBackOff , 当status 不是running 时,需要进一步查看该pod 的执行情况,可以在describe 中看到实际failed 的原因

kubectl describe pod nginx-55bd7c9fd-94tj5​

 


扩展: 如果是连接超时pull失败,可改docker 镜像为阿里镜像,在/etc/docker/daemon.json中加入,注意如果原来已有内容,新增记录时,需以逗号隔开上下文。否则daemon reload后 会因配置文件语法错误无法restart docker

 

/etc/docker/daemon.json
2020-01-19 10:00:21    1521    0    0

ubuntu ISO 安装镜像的定制

 

1. 基本的系统镜像需要哪些组成部分

 

2.引导部分

 

3.软件预装设置

https://help.ubuntu.com/16.04/installation-guide/amd64/apb.html

https://help.ubuntu.com/18.04/installation-guide/amd64/index.html

 

 

4.preseed

 

5.isolinux

 

6.grub.cfg

 

7. ubuntu 18

支持的架构有4:AMD64, ARM, POWER8, LinuxONE and z Systems 

ubuntu 10 及以前, 桌面版和服务器版的内核版本是有作区分。这以后,便合并为一个单独的通用内核版本,以降低维护成本。

Ubuntu 18.04支持六种主要的架构和每一种架构的几种变体,称为“口味”。另一个架构(IBM/Motorola PowerPC)有一个非官方的端口。支持AMD64和Intel 64处理器。

 

Debian

Debian是一个全志愿组织,致力于开发自由软件和促进自由软件社区的理想。Debian项目开始于1993年,当时Ian Murdock向软件开发人员发出了一个开放的邀请,邀请他们为一个基于相对较新的Linux内核的完整和一致的软件发行版做出贡献。最初由自由软件基金会(Free Software Foundation)资助并受GNU哲学影响的这一小群热心的爱好者,经过多年的发展,已经成长为一个大约有1026名Debian开发人员的组织。

 

universe 组件? 

For users that want access to every known package, Ubuntu provides a "universe" component (set of packages) where users of Ubuntu systems install the latest version of any package that is not in the supported set. Most of the packages in Ubuntu universe are also in Debian, although there are other sources for universe to

? jenkins ?    2020-01-14 14:53:51    1074    0    0

背景

1. node 读取label 时只认表达式结果,不认变量

2. pipeline 中 node('label'){}  也同样无法取参数值

 

mark 解决等解决

 


 

1. 设置接收node label 的参数 (有问题,不能匹配变量,只能接收常量正则匹配)

2. 从node插件源码入手,找到label 的结构 和  传输时的类型转换 -- ing

3. 检索是否有对应的已开发私人插件

 

临时方案:

4.  再添加一个中间层 的job , 在第一次判断使用哪个node , 再根据结果去到中间层的job , 中间层的几个job ,jobname 与 node label 设置为对应。

-------------更新于2020.1.4   已经有 node 参数插件了。在插件管理中搜索node 或agent 或label

? gitlab ?    2019-11-04 16:22:09    2099    2    0

Push Rule


设置的位置 Gitlab project 的settings
repository -> Push Rules -> Commit message:

示例:

  1. ^(I|i)ssue \d{4,6} \/*
  2. ^(Issue|issue|bug|Bug) #\d{1,7} \/*

示例含义:

  1. ^(I|i)ssue 开头
  2. \d{4,6} 表示4-6位数字
  3. \/* 表示任意内容

即以上示例匹配以下格式:

  1. [I|i]ssue空格4-6位数字空格任意内容
  2. Issue 1234 gfdg dgdfgdfgdff
  3. Issue 124455 ggfdgd gd

其他匹配细节可参考:
https://github.com/google/re2/wiki/Syntax

不符合commit message匹配规则的commit 无法被push , 此时gitlab 会给出匹配提示,以实际项目中设置的格式为准,比如:

  1. remote: GitLab: Commit message does not follow the pattern '^(I|i)ssue \d{4,6} \/*'

以下介绍如何处理修正不匹配规则的commit message。

三种情况
- [1] gitlab web 页面直接提交时(即直接在远程push 一条commit)
- [2] 提交一个merge request 时,merge request 本身产生一条合并的commit
- [3] 本地仓库的commit 推送到远程仓库时

以上情况,在push时,会对commit message , 对merge reuqest 的title 进行上方设置规则的匹配校验,检验不成功则push 不成功。


gitlab web 页面直接提交时

title


提交一个merge request

title


本地仓库的commit 推送到远程仓库时

本地仓库的commit message 不符合匹配规则,导致在push这些不合规的commit到remote repo时报错:
--push failed: r

? gitlab ?    2019-11-04 16:07:22    24111    1    0

gitlab 的 release 功能是项目交付跟踪的一种方式


Gitlab 的release 功能不止将源代码快照(tag) 与版本对应记录,其他版本信息,如目标产物,修改说明,相关文档链接等,都可以在一个release 里跟踪。

目前在GitLab 11.7 以上版本已经包含了release 的功能,但是现在(2019-11-1)为止,Release 的入口只支持API接入。


更新信息:
Gitlab 的 release 现在已支持在界面上直接以 “new release” 进入编辑。
以下说明皆为使用 api 新建release 的方法:(此句更新于2021.5.6)


图片标题
https://docs.gitlab.com/ee/api/releases/index.html

官方文档相关说明


一个release 可以包含两大块资源: 代码和链接。后续会支持更多资源的关联,包含容器等

  1. Release assets
  2. You can currently add the following types of assets to each Release:
  3. Source code: state of the repo at the time of the Release
  4. Links: to content such as built binaries or documentation
  5. GitLab will support more asset types in the future, including objects such as pre-built packages, compliance/security evidence, or container images.

关联的资源


Source code

实际是映射到 tag 对应的源码版本 ,tag 信息是需要在创建release 时提供。

link

目前支持 http, https, ftp 链接。一个release 里可以有多个link , 每个link 用字典管理,分别有自己的 id tag_name n

? expect ?    2019-10-23 15:31:52    446    0    0

 

前面在 “expect:scp/ftp 自动化 ”  这一篇中提到:

interact:执行完毕后保持交互状态,并等待手工输入的操作了。

由于ftp 输入密码时敲错时不能使用ctrl+ backspace 进行回退,于是写了一个脚本用于自动操作登录部分,并在脚本执行结束时,将操作交互权交回给控制台,继续手工执行ftp 命令

 

loginftp.sh  ${yuser}  ${ypassword}

#!/usr/bin/expect
set timeout 7200
set FTP "ftp>"
spawn ftp ftp.xxxx.com
 expect {
 "):"
 { send "${yuser}\n"
 expect "*assword:" {send "${ypassword}\n"}
 }
 "*couldn't execute*no such file*"
 {
 print "ftp not install"
 }
}
interact​

 

2019-10-12 14:46:06    208    0    0

http://www.zsythink.net/archives/tag/iptables/

 

整理中。。

iptable

  • iptable 按设置的规则执行
  • 规则规定了 源地址 目标地址 传输协议 服务类型 等
  • 数据包如果符合这些规则,就进行对应的操作
  • 操作的类型的 放行(accept),拒绝(reject),丢弃(drop)

 

而我们对iptables 的配置,实际是就是对iptable中 的规则进行增 删 改。

 

 

概念:

数据包流向,链,表

 

1. 数据包流向

 

2. 链

 

3. 表

iptable 定义了4种表,缺省是filter, 其他表可用-t 指定

2019-10-12 10:22:29    294    0    0

Ubuntu - 64位系统缺失32位共享库

报错

  1. Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)
  2. Stack Trace:
  3. java.lang.UnsatisfiedLinkError: /opt/AccuRev/jre/lib/i386/xawt/libmawt.so: libXext.so.6: cannot open shared object file: No such file or directory
  4. at java.lang.ClassLoader$NativeLibrary.load(Native Method)
  5. #../jre/lib/**i386**/xawt/libmawt.so:libXext.so.6
  6. 这个报错表明程序安装目录有一个32位的libmawt.so需要调用32位的共享库libXext.so.6,但是找不到该库。

解决思路

一般报此错是因为64位系统执行的软件需要32位共享库的支持:

  1. #确认64位内核架构
  2. >dpkg --print-architecture
  3. amd64
  4. #确认‘支持32位’ 是否打开
  5. >dpkg --print-foreign-architectures
  6. i386
  7. #如果没有打开支持32位的功能,需打开
  8. >sudo dpkg --add-architecture i386

安装32位库:

  1. apt-get install libxext6:i386
  2. #安装报错指出的库后,再行,发现已经pass , 继续报其他丢失库,继续安装
  3. apt-get install libxtst6:i386
  4. apt-get install libxi6:i386
? svn ? ? shell ?    2019-10-12 10:00:26    1756    1    0

svn 强制提交日志

分析:

检查时间:提交前

效果:日志符合要求成功提交,日志不符合要求给出提示,并中断提交。

 

适用钩子脚本:svn -> hooks -> pre-commit (commit 前触发执行的脚本),当svn 有commit 请求时,会触发执行pre-commit(shell脚本),当这个脚本以非0退出时,中断commit , 当脚本正常退出时,允许commit.

 

进入版本库配置目录hooks ,可见模板 pre-commit.tmpl ,复制为pre-commit 。

root@tclserver:/var/svn/svn_dir/Auto_script/hooks# ll
-rwxr-xr-x 1 root root 3350 Apr 6 2017 pre-commit*
-rwxr-xr-x 1 root root 3510 Feb 6 2017 pre-commit.tmpl*


 pre-commit.tmpl 原模板的内容分析

# PRE-COMMIT HOOK
#
# The pre-commit hook is invoked before a Subversion txn is
# committed.  Subversion runs this hook by invoking a program
# (script, executable, binary, etc.) named 'pre-commit' (for which
# this file is a template), with the following ordered arguments:
#
#   [1] REPOS-PATH   (the path to this repository)
#   [2] TXN-NAME     (the name of the txn about to be committed)
#   ........
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
 grep "[a-zA-Z0-9]" > /dev/null |
? gitlab ?    2019-09-18 13:45:21    255    0    0
6/12