首页 > 其他分享 >(四)Kubernetes部署storm后的kill命令找不到的问题

(四)Kubernetes部署storm后的kill命令找不到的问题

时间:2023-07-19 11:45:42浏览次数:38  
标签:... java Kubernetes 1.2 kill storm org amd64

使用Kubernetes部署storm集群后,发现Supervisor在运行过程中不断重启,十分奇怪。

因此新开一个窗口追踪Supervisor的日志supervisor.log。最终发现每次storm在rebalance的时候,Supervisor需要kill掉本节点上的进程。但由于storm:1.2.2中的kill命令是一个shell内置命令,导致Supervisor调用不到,最终程序异常退出,pod也因此重启。

具体日志信息如下:

2023-07-19 02:14:48.370 o.a.s.d.s.Container SLOT_6700 [INFO] Killing df3bf58e-6387-4c7a-867b-11e5ba2c9a85:8bf1dd6a-42c1-4a29-90ae-86e46e6ece54
2023-07-19 02:14:48.370 o.a.s.d.s.Container SLOT_6701 [INFO] Killing df3bf58e-6387-4c7a-867b-11e5ba2c9a85:5cbe5261-5e54-4333-9898-823126e35193
2023-07-19 02:14:48.378 o.a.s.u.Utils SLOT_6701 [INFO] IOException Error when trying to kill 160.
2023-07-19 02:14:48.378 o.a.s.u.Utils SLOT_6700 [INFO] IOException Error when trying to kill 163.
2023-07-19 02:14:48.378 o.a.s.d.s.Slot SLOT_6701 [ERROR] Error when processing event
java.io.IOException: Cannot run program "kill" (in directory "."): error=2, No such file or directory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[?:1.8.0_222]
        at java.lang.Runtime.exec(Runtime.java:620) ~[?:1.8.0_222]
        at org.apache.storm.shade.org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.shade.org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:254) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.shade.org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:319) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.shade.org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.shade.org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.utils.Utils.execCommand(Utils.java:1904) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.utils.Utils.sendSignalToProcess(Utils.java:1936) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.utils.Utils.killProcessWithSigTerm(Utils.java:1951) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.daemon.supervisor.Container.kill(Container.java:166) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.daemon.supervisor.Container.kill(Container.java:184) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.daemon.supervisor.Slot.killContainerForChangedAssignment(Slot.java:311) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.daemon.supervisor.Slot.handleRunning(Slot.java:527) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.daemon.supervisor.Slot.stateMachineStep(Slot.java:265) ~[storm-core-1.2.2.jar:1.2.2]
        at org.apache.storm.daemon.supervisor.Slot.run(Slot.java:752) [storm-core-1.2.2.jar:1.2.2]
Caused by: java.io.IOException: error=2, No such file or directory
        at java.lang.UNIXProcess.forkAndExec(Native Method) ~[?:1.8.0_222]
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) ~[?:1.8.0_222]
        at java.lang.ProcessImpl.start(ProcessImpl.java:134) ~[?:1.8.0_222]
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ~[?:1.8.0_222]
        ... 15 more
command terminated with exit code 137

进入storm:1.2.2中查看kill命令:

root@ubuntu:# docker run -it storm:1.2.2 /bin/bash
root@f5eacdd1fb1b:/apache-storm-1.2.2# type kill
kill is a shell builtin

解决方案

基于当前storm:1.2.2构建新镜像,并添加procps包以提供kill命令

Dockerfile

由于我的网络是走代理连接的,因此设置了代理的环境变量。

# 基于原有的storm镜像
FROM storm:1.2.2

# 设置代理
ENV http_proxy http://proxy.example.com:8080
ENV https_proxy http://proxy.example.com:8080
ENV no_proxy localhost,127.0.0.1

# 更新系统并安装procps包
RUN apt-get update && apt-get install -y procps

构建新镜像

root@ubuntu:# docker build -t storm-fix:1.2.2 .
Sending build context to Docker daemon  43.01kB
Step 1/5 : FROM storm:1.2.2
 ---> 03a242e39169
Step 2/5 : ENV http_proxy http://proxy.example.com:8080
 ---> Running in d4c2677998f4
Removing intermediate container d4c2677998f4
 ---> d7116525b99d
Step 3/5 : ENV https_proxy http://proxy.example.com:8080
 ---> Running in ece93acfc2b7
Removing intermediate container ece93acfc2b7
 ---> 636b49a5f653
Step 4/5 : ENV no_proxy localhost,127.0.0.1
 ---> Running in f117ce7433dd
Removing intermediate container f117ce7433dd
 ---> c8b2f42d2eba
Step 5/5 : RUN apt-get update && apt-get install -y procps
 ---> Running in d01ab77eb7bb
Get:1 http://security.debian.org/debian-security buster/updates InRelease [34.8 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [56.6 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [541 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7909 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [8788 B]
Fetched 8672 kB in 10s (849 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libgpm2 libncurses6 libncursesw6 libprocps7 libtinfo6 psmisc
Suggested packages:
  gpm
The following NEW packages will be installed:
  libgpm2 libncurses6 libprocps7 procps psmisc
The following packages will be upgraded:
  libncursesw6 libtinfo6
2 upgraded, 5 newly installed, 0 to remove and 60 not upgraded.
Need to get 1041 kB of archives.
After this operation, 1931 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 libprocps7 amd64 2:3.3.15-2 [61.7 kB]
Get:2 http://security.debian.org/debian-security buster/updates/main amd64 libtinfo6 amd64 6.1+20181013-2+deb10u3 [326 kB]
Get:3 http://deb.debian.org/debian buster/main amd64 procps amd64 2:3.3.15-2 [259 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 libgpm2 amd64 1.20.7-5 [35.1 kB]
Get:5 http://security.debian.org/debian-security buster/updates/main amd64 libncursesw6 amd64 6.1+20181013-2+deb10u3 [132 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 psmisc amd64 23.2-1+deb10u1 [126 kB]
Get:7 http://security.debian.org/debian-security buster/updates/main amd64 libncurses6 amd64 6.1+20181013-2+deb10u3 [102 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 1041 kB in 7s (156 kB/s)
(Reading database ... 8106 files and directories currently installed.)
Preparing to unpack .../libtinfo6_6.1+20181013-2+deb10u3_amd64.deb ...
Unpacking libtinfo6:amd64 (6.1+20181013-2+deb10u3) over (6.1+20181013-2) ...
Setting up libtinfo6:amd64 (6.1+20181013-2+deb10u3) ...
(Reading database ... 8106 files and directories currently installed.)
Preparing to unpack .../libncursesw6_6.1+20181013-2+deb10u3_amd64.deb ...
Unpacking libncursesw6:amd64 (6.1+20181013-2+deb10u3) over (6.1+20181013-2) ...
Setting up libncursesw6:amd64 (6.1+20181013-2+deb10u3) ...
Selecting previously unselected package libncurses6:amd64.
(Reading database ... 8106 files and directories currently installed.)
Preparing to unpack .../libncurses6_6.1+20181013-2+deb10u3_amd64.deb ...
Unpacking libncurses6:amd64 (6.1+20181013-2+deb10u3) ...
Selecting previously unselected package libprocps7:amd64.
Preparing to unpack .../libprocps7_2%3a3.3.15-2_amd64.deb ...
Unpacking libprocps7:amd64 (2:3.3.15-2) ...
Selecting previously unselected package procps.
Preparing to unpack .../procps_2%3a3.3.15-2_amd64.deb ...
Unpacking procps (2:3.3.15-2) ...
Selecting previously unselected package libgpm2:amd64.
Preparing to unpack .../libgpm2_1.20.7-5_amd64.deb ...
Unpacking libgpm2:amd64 (1.20.7-5) ...
Selecting previously unselected package psmisc.
Preparing to unpack .../psmisc_23.2-1+deb10u1_amd64.deb ...
Unpacking psmisc (23.2-1+deb10u1) ...
Setting up libgpm2:amd64 (1.20.7-5) ...
Setting up psmisc (23.2-1+deb10u1) ...
Setting up libprocps7:amd64 (2:3.3.15-2) ...
Setting up libncurses6:amd64 (6.1+20181013-2+deb10u3) ...
Setting up procps (2:3.3.15-2) ...
update-alternatives: using /usr/bin/w.procps to provide /usr/bin/w (w) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/w.1.gz because associated file /usr/share/man/man1/w.procps.1.gz (of link group w) doesn't exist
Processing triggers for libc-bin (2.28-10) ...
Removing intermediate container d01ab77eb7bb
 ---> dacf56c95507
Successfully built dacf56c95507
Successfully tagged storm-fix:1.2.2

最后将storm.yaml的部署文件中的镜像修改为storm-fix:1.2.2即可

标签:...,java,Kubernetes,1.2,kill,storm,org,amd64
From: https://www.cnblogs.com/Modest-Hamilton/p/17565170.html

相关文章

  • some words:brainstorm review identify implement analyse
    Brainstormmeanstohaveadisscussiontosuggestlotsofideasforanactivityorforsolvingaproblem.eg.Let'sbrainstormthenextgameplanning.Wealwaysbrainstormsomeideasfornewgame. Reviewmeanstoexamineorlookatcarefully,espec......
  • centos7 批量杀进程(批量kill -9)
    命令为ps-ef|grep进程名|grep-vgrep|awk'{print"kill-9"$2}'|bash例如:后台启动了n个java程序,想要一下子都杀掉,启动时候执行该命令启动的javacn.edu.ruc.cmd.BootStrap则批量杀进程命令为ps-ef|grepcn.edu.ruc.cmd.BootStrap|grep-vgrep|awk'{print"......
  • kubernetes证书过期申请新的证书
    证书过期[root@k8s-master~]#kubectlgetpodsUnabletoconnecttotheserver:x509:certificatehasexpiredorisnotyetvalid查看证书的生效日期(发现已经过期)[root@k8s-master1~]#echo|openssls_client-showcerts-servernamegnupg.org-connectlocalho......
  • 通过kubectl连接Kubernetes集群
    1、安装kubectl本地客户端安装kubectl添加kubernete阿里云yum源#cat>/etc/yum.repos.d/kubernetes.repo<<EOF[kubernetes]name=Kubernetesbaseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64enabled=1gpgcheck=0repo_gpgcheck=0gp......
  • kubernetes之 dashboard展示
    第十一dashboard展示一直使用kubectl命令操作apiserver实现dashboard作为k8s核心附件存在的,官网部署:https://github.com/kubernetes/dashboard根据教程,还是安装老版本的镜像吧[root@k8s-masterdashboard]#kubectlapply-fhttps://raw.githubusercontent.com/kubernetes/dashb......
  • kubernetes之 RBAC
    第十一部分RBACrestful操作对象:许可授权都作用于角色,用户是什么角色,就拥有什么操作权限授权插件:Node、ABAC、RBAC、WebhookRBAC:Role-basedAC角色:Role许可:permission关联图示客户端访问示意图:role:operations:许可object:rolebinging:useraccountorserviceacco......
  • kubernetes之 认证和serviceaccount
    第十部分认证和serviceaccount前面讲的都是admin超级用户在操作k8s,Kubectl不能所有人都可以使用和访问。用户访问逻辑图,认证:第一种令牌认证token,最简单的认证,(只需要对方认证的共享密钥即可)服务器需要认可客户端的证书。授权:RBAC,基于角色的访问控制,目前用的比较多。    ......
  • kubernetes之 statefulset控制器
    第九部分statefulset控制器参考:https://blog.csdn.net/styshoo/article/details/73731993     https://blog.51cto.com/xuexinhuan/5424144即便是有状态管理,也需要使用脚本来运维。CoreOS:OperatorStatusfulSet:有状态Cattle,petPetSet->StatefulSeta、稳定......
  • kubernetes网络模式
     一个K8s的集群中至少有三个网络:集群节点所在的网络,这个网络就是你的主机所在的网络,通常情况下是你的网络基础设施提供。如果你的node处于不同的网段,那么你需要保证路由可达。如上图中的192.168.10.0/24和10.0.0.0/8这两个网络第二个网络是Pod的网络,K8s中一个Pod由多个......
  • Ubuntu部署Kubernetes
    Docker安装信任Docker的GPG公钥:curl-fsSLhttps://repo.huaweicloud.com/docker-ce/linux/ubuntu/gpg|sudoapt-keyadd-`添加软件仓库:sudoadd-apt-repository"deb[arch=amd64]https://repo.huaweicloud.com/docker-ce/linux/ubuntu$(lsb_release-cs)stable"......