「KUBERNETES」- 网络环境设置 | 网络调试工具

kubectl create deployment busybox –image=busybox — sleep infinity

kubectl apply -f ./network-multitool.yaml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: debugbox
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: debugbox
  template:
    metadata:
      labels:
        app: debugbox
    spec:
      containers:
      - name: debugbox-busybox
        image: busybox
        imagePullPolicy: IfNotPresent
        command: ['sh', '-c', 'echo Container is Running ; sleep infinity']
      - name: debugbox-network
        image: praqma/network-multitool:latest
        command: 
        - nc
        - -l
        - -k
        - -p
        - "80"
        - -e
        - ls
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: debugbox
  namespace: default
spec:
  ports:
  - name: debugging-port
    nodePort: 32767
    port: 2767
    protocol: TCP
    targetPort: 80
  selector:
    app: debugbox
  type: NodePort
  externalTrafficPolicy: Local