
Markdown语法指南
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. ...
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. ...
Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries. ...
最近给客户调试 macvlan network时,遇到了Linux kernel 报错 SIOCSIFFKAGS: Device or resource busy. 无法创建网络device。 结果长时间的debug分析, 发现问题是高并发压测 创建和释放macvlan device的时候,设备的mac address出现了重复。 ps:这个问题只出现在 macvlannetwork 的设备中。 可以用下面的shell脚本来复现macvlan Device or resource busy的错误: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #!/bin/bash function setup { i=$1 ip l a m$i address 00:40:2F:4D:5E:6F link eth0 type macvlan mode bridge ip netns add ns$i ip l set m$i netns ns$i sleep 1 ip netns exec ns$i ifconfig m$i 10.0.0.$((i+1))/24 up echo $? } echo cleaning up ip -all netns d echo creating netsnses for i in `seq $1`; do echo $i.... #setup $i & setup $i done 如果把 macvlan 类型改为 dummy (上面脚本第5行 type macvlan 改为 type dummy) ,即使 MAC address 重复也不会引发kernel 报错。 ...
PLEG 不熟悉PLEG(Pod Lifecycle Event Generator)的同学,可以先看下这篇文章What is PLEG?。 这篇文章对pleg是什么和常见的unhealthy问题有很详细的介绍。 cni 当k8s的 cni 插件性能较差,node上的pod 数量较多(大于 80)的时候,我们常常会遇到PLEG出错的问题: PLEG is not healthy: pleg was last seen active 6m55.488150776s ago; threshold is 3m0s 调试kuryr cni的时候,发现当openstack neutron服务压力比较大的时候。 cni这边申请和释放 port的时延会相应的增加,导致虚拟机大量堆积无效的netns, 然后就会遇到由kueblet PLEG not healthy引起的docker hang 住问题。 docker 重启 docker 和 kueblet 可以暂时解决PLEG unhealthy。 1 2 3 4 5 systemctl restart docker systemctl restart kubelet # do NOT use `docker rm -vf`, # which will kill running containers docker rm -v `docker ps -qa` 建议同时修改 kubelet 启动参数 –housekeeping-interval=30s ...
base 通过修改ibase和obase可以实现各种进制的转化,比如十进制和二进制和十六进制之间的转换; If you aren’t familiar with conversion between decimal, binary, and hexadecimal formats, you can use a calculator utility such as bc or dc to convert between different radix representations. For example, in bc, you can run the command obase=2; 240 to print the number 240 in binary (base 2) form. 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 32 #!/bin/bash ❯ bc -q ibase 10 obase 10 1+ 3 *3 10 obase=2 245 11110101 255 11111111 192 11000000 168 10101000 1 1 172 10101100 obase=16 34 22 172 AC ^D% syntax 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 bc An arbitrary precision calculator language. More information: https://manned.org/bc. - Start bc in interactive mode using the standard math library: bc -l - Calculate the result of an expression: bc <<< "(1 + 2) * 2 ^ 2" - Calculate the result of an expression and force the number of decimal places to 10: bc <<< "scale=10; 5 / 3" - Calculate the result of an expression with sine and cosine using mathlib: bc -l <<< "s(1) + c(1)"
今天测试给我反馈了一个pod问题,测试给出的 use case 描述如下: 配置一个nginx的web服务; 在生命周期中选择http协议,端口配置80,路径配置/errorpath; 服务中pod能正常启动; 预期在pod的事件中应该有一个“FailedPostStartHook”错误信息。 测试人员发现,第4点的预期没有达到,pod 正常启动了,却没有 FailedPostStarHook事件出现。 简单分析了一下,我发现是测试人员把pod的lifecycle和 pod的liveness/readiness 诺混淆了,从而写出了错的test case。 Lifecycle handlers 首先回顾下pod lifecycle的作用: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 kubectl explain pod.spec.containers.lifecycle.postStart RESOURCE: postStart <Object> DESCRIPTION: PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/ container-lifecycle-hooks/#container-hooks/ Handler defines a specific action that should be taken 简单翻译下就是说, kubernetes 提供的pod start和exit的 lifecycle hooks 方便开发人员hooked到 ...
之前写了一篇post 适配腾讯云backend 的文章,从代码的角度简单记录了flannel vpc backend实现过程。 这篇文章是对前面文章的补充,全局鸟瞰描绘了flannel vpc backend网络数据包的流动过程。 总体来看vpc 和 host-gw 模式是很类似的,理解host-gateway模式 对理解vpc 模式很有帮助。 host gw host gateway 模式: host-gw adds route table entries on hosts, so that host know how to traffic container network packets. This works on L2, because it only concerns hosts, switches and containers. switches does not care IP and route, hosts know containers exists, and how to route to them, containers just send and receive data. ...
最近开发的遇到一个需求是在判断 两个目录是否相互包含。 想着用正则表达式或者递归去解决,捣鼓一段时间后发现总有些edge case 不能cover到, 后来发现用 python 的pathlib 可以很好的解决。 1 2 3 4 5 6 7 from pathlib import Path def overlapping(a, b): if a == b: return True a_path = Path(a) b_path = Path(b) return a_path in b_path.parents or b_path in a_path.parents
有一个app 跑在pod里面,这个app 默认会输出自己的运行日志到syslogd, 请问如何让host主机上运行的syslogd日志收集器收集到上面app输出的运行日志呢? /dev/log 答案:把 主机的 /dev/log目录挂载到 pod 里面的 /dev/log即可。 Some of these messages need to be brought to a system administrator’s attention immediately. And it may not be just any system administrator – there may be a particular system administrator who deals with a particular kind of message. Other messages just need to be recorded for future reference if there is a problem. Still others may need to have information extracted from them by an automated process that generates monthly reports. ...
一般来说,kubernetes 的pod是不在master 节点上运行的。 如果要求pod 必须被调度到master 节点上运行,可以修改pod 的 toleration 和 affinity。 toleration和affinity: 在pod加上toleration和affinity配置 yaml 1 2 3 4 5 6 7 8 9 10 11 12 13 spec: tolerations: - key: "node-role.kubernetes.io/master" operator: "Equal" value: "true" effect: "NoSchedule" affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 + Operator: apiv1.TolerationOpExists, + Effect: apiv1.TaintEffectNoSchedule, + }, + }, + Affinity: &apiv1.Affinity{ + NodeAffinity: &apiv1.NodeAffinity{ + RequiredDuringSchedulingIgnoredDuringExecution: &apiv1.NodeSelector{ + NodeSelectorTerms: []apiv1.NodeSelectorTerm{ + apiv1.NodeSelectorTerm{ + MatchExpressions: []apiv1.NodeSelectorRequirement{ + apiv1.NodeSelectorRequirement{ + Key: "node-role.kubernetes.io/master", + Operator: apiv1.NodeSelectorOpExists, + }, + }, + }, + }, + },