1. 环境
系统: CentOS 7.3
内核: x86
环境: 虚拟机
2. 问题
收到一个现场问题, k8s 环境中 nginx 的 pod 都启动异常.
- #kubectl get pod |grep nginx
- nginx-7945cf468c-z7z9r 0/1 Running 0 10m17m
看 pod 日志无任何有效信息, 于是进入 nginx 的 pod, 执行 nginx 二进制, 报错 Illegal instruction (core dumped)
- ~# kubectl exec -ti nginx-7945cf468c-z7z9r bash
- bash-4.4# /usr/local/openresty/nginx/sbin/nginx -h
- Illegal instruction (core dumped)
3. 猜想及答案
针对上述问题于是产生如下猜想:
镜像损坏
系统安装了安全软件
系统做过内核或参数升级
判断问题 1: 镜像损坏, 于是找到 nginx pod 编译前的 nginx base 镜像, 直接 docker run 启动后执行 nginx 二进制, 问题相同;
判断问题 2: 根据一番了解, 现场环境之前装过三合一, 和瑞星杀毒, 但都已经关闭, 没有相关进程;
判断问题 3: 了解到现场环境未做内核升级及修改系统参数.
在一番思考和查到后得到下面这句话:
于是用如下命令查了一下 CPU 指令集
- #grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
- SSE 4.2 not supportedj
竟然 CPU 不支持 SSE 4.2 指令集. 查看正常运行的环境是支持的
- # grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
- "SSE 4.2 supported"
于是咨询现场是否迁移过虚拟机, 果然迁移过.
于是再找到支持 SSE 4.2 指令集的物理机进行迁移后, 环境恢复, nginx 正常启动, 问题得到解决.
参考文档:
来源: http://www.bubuko.com/infodetail-3787477.html