性能优化与故障处理

概述

参考:

为什么 Pod 突然就不见了?

https://mp.weixin.qq.com/s/bbp3OoEF0_Cc1obFBsROSg

创建测试容器

web

apiVersion: v1
kind: Service
metadata:
  name: myapp
  namespace: test
  labels:
    app: myapp
spec:
  ipFamilyPolicy: PreferDualStack
  ipFamilies:
    - IPv6
    - IPv4
  ports:
    - name: http
      port: 80
      targetPort: 80
      nodePort: 30080
  type: NodePort
  selector:
    app: myapp
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myapp
  name: myapp
  namespace: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      name: myapp
      labels:
        app: myapp
    spec:
      containers:
        - name: myapp-container
          # image: lchdzh/network-test
          image: containous/whoami
          tty: true
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: myapp
  namespace: test
spec:
  ingressClassName: nginx
  rules:
    - host: myapp.example.com
      http:
        paths:
          - backend:
              service:
                name: myapp
                port:
                  number: 80
            path: /myapp
            pathType: ImplementationSpecific

debug

apiVersion: v1
kind: Pod
metadata:
  name: debug
  namespace: test
  labels:
    app: debug
spec:
  containers:
    - name: debug-container
      image: lchdzh/k8s-debug:v1
      tty: true

最后修改 March 25, 2025: clearup (feb59d93)