如何远程调试k8s里的jettypod

 

发布一个k8s部署视频:https://edu.csdn.net/course/detail/26967

课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。

腾讯课堂连接地址https://ke.qq.com/course/478827?taid=4373109931462251&tuin=ba64518

第二个视频发布  https://edu.csdn.net/course/detail/27109

腾讯课堂连接地址https://ke.qq.com/course/484107?tuin=ba64518

介绍主要的k8s资源的使用配置和命令。包括configmap,pod,service,replicaset,namespace,deployment,daemonset,ingress,pv,pvc,sc,role,rolebinding,clusterrole,clusterrolebinding,secret,serviceaccount,statefulset,job,cronjob,podDisruptionbudget,podSecurityPolicy,networkPolicy,resourceQuota,limitrange,endpoint,event,conponentstatus,node,apiservice,controllerRevision等。

第三个视频发布:https://edu.csdn.net/course/detail/27574

详细介绍helm命令,学习helm chart语法,编写helm chart。深入分析各项目源码,学习编写helm插件
————————————————

#===========================================================
# Jetty start.jar arguments
# Each line of this file is prepended to the command line 
# arguments # of a call to:
#    java -jar start.jar [arg...]
#===========================================================



#===========================================================
# If the arguements in this file include JVM arguments 
# (eg -Xmx512m) or JVM System properties (eg com.sun.???),
# then these will not take affect unless the --exec 
# parameter is included or if the output from --dry-run
# is executed like:
#   eval $(java -jar start.jar --dry-run)
#
# Below are some recommended options for Sun's JRE
#-----------------------------------------------------------
--exec
# -Dorg.apache.jasper.compiler.disablejsr199=true
# -Dcom.sun.management.jmxremote
# -Dorg.eclipse.jetty.util.log.IGNORED=true
# -Dorg.eclipse.jetty.LEVEL=DEBUG
# -Dorg.eclipse.jetty.util.log.stderr.SOURCE=true
-server
-verbose:gc 
-Xms1024m
-Xmx1024m
-Xmn512m
-XX:PermSize=128m 
-XX:MaxPermSize=128m 
-XX:ParallelGCThreads=1 
-Djava.security.egd=file:/dev/./urandom 
-XX:+PrintGCDetails 
-XX:+PrintGCDateStamps 
-Djava.awt.headless=true 
-Djava.net.preferIPv4Stack=true 
-Dsun.net.client.defaultConnectTimeout=10000 
-Dsun.net.client.defaultReadTimeout=30000 
-Djava.net.preferIPv4Stack=true 
#-Xloggc:../logs/gc.log 
# -XX:+PrintGCTimeStamps
# -XX:+PrintTenuringDistribution
# -XX:+PrintCommandLineFlags
# -XX:+DisableExplicitGC
# -XX:+UseConcMarkSweepGC
# -XX:ParallelCMSThreads=2
# -XX:+CMSClassUnloadingEnabled  
# -XX:+UseCMSCompactAtFullCollection
# -XX:CMSInitiatingOccupancyFraction=80
#-----------------------------------------------------------

-Xdebug
-Xrunjdwp:transport=dt_socket,address=26666,server=y,suspend=n
#===========================================================
# Start classpath OPTIONS.
# These control what classes are on the classpath
# for a full listing do
#   java -jar start.jar --list-options
#-----------------------------------------------------------
#OPTIONS=Server,jsp,jmx,resources,websocket,ext,plus,annotations
OPTIONS=Server,jsp
#-----------------------------------------------------------


#===========================================================
# Configuration files.
# For a full list of available configuration files do
#   java -jar start.jar --help
#-----------------------------------------------------------
#etc/jetty-jmx.xml
#etc/jetty.xml
## etc/jetty-annotations.xml
# etc/jetty-ssl.xml
# etc/jetty-requestlog.xml
#etc/jetty-deploy.xml
#etc/jetty-overlay.xml
#etc/jetty-webapps.xml
#etc/jetty-contexts.xml
## etc/jetty-testrealm.xml
#===========================================================

修改jetty.ini配置文件加上:

 

-Xdebug
-Xrunjdwp:transport=dt_socket,address=26666,server=y,suspend=n

26666是调试端口.

创建一个nodePort类型的service

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: 2018-05-07T12:13:23Z
  labels:
    app: liward
  name: liward-web
  namespace: dev-app
  resourceVersion: "1980618"
  selfLink: /api/v1/namespaces/dev-app/services/liward-web
  uid: 09b7cd71-51f0-11e8-8c57-002197403677
spec:
  clusterIP: 10.103.193.113
  externalTrafficPolicy: Cluster
  ports:
  - name: http
    nodePort: 32730
    port: 8080
    protocol: TCP
    targetPort: 8080
  - name: debug
    nodePort: 30001
    port: 26666
    protocol: TCP
    targetPort: 26666
  selector:
    app: liward
  sessionAffinity: None
  type: NodePort
status:
  loadBalancer: {

看到targetPort和调试端口一致。

30001为客户端连接调试端口。

然后就可以用hostIp+30001调试pod里的容器了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hxpjava1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值