腾讯云 - pod独立IP并绑定CLB

2022-12-01

Service使用已有CLB
Pod 直接绑定弹性公网 IP
VPC-CNI 模式安全组使用说明
image.png

image.png

# https://cloud.tencent.com/document/product/457/64886
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: squid-demo
  name: squid-demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: squid-demo
  serviceName: ""
  template:
    metadata:
      annotations:
        service.cloud.tencent.com/direct-access: "true"
        service.kubernetes.io/service.extensiveParameters: '{"AddressIPVersion":"IPV4"}'
        tke.cloud.tencent.com/networks: "tke-route-eni"
        tke.cloud.tencent.com/vpc-ip-claim-delete-policy: Never
        tke.cloud.tencent.com/eip-attributes: '{"Bandwidth":"100","ISP":"BGP"}'
        tke.cloud.tencent.com/eip-claim-delete-policy: "Never" #表明 Workload 的 Pod 的 EIP 也需要固定,Pod 销毁后不能变更。若不需要固定,则不添加该注解。
      labels:
        app: squid-demo
    spec:
      containers:
      - image: registry.cn-hangzhou.aliyuncs.com/yqn-library/squid:3.5.8-curl
        imagePullPolicy: IfNotPresent
        name: squid-demo
        resources:
          limits:
            tke.cloud.tencent.com/eni-ip: "1"
            tke.cloud.tencent.com/eip: "1"
            memory: 500Mi
          requests:
            tke.cloud.tencent.com/eni-ip: "1"
            tke.cloud.tencent.com/eip: "1"
            memory: 250Mi

---

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.cloud.tencent.com/direct-access: "true"
    service.kubernetes.io/tke-existed-lbid: lb-n9d4gypz
    service.kubernetes.io/service.extensiveParameters: '{"AddressIPVersion":"IPV4"}'
#    service.cloud.tencent.com/enable-grace-shutdown: "true"  # 表示使用优雅停机
  name: svc-squid-demo
spec:
  allocateLoadBalancerNodePorts: true
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: 23888-demo-tcp
    port: demo
    protocol: TCP
    targetPort: 23888
  selector:
    app: squid-demo
  sessionAffinity: None
  type: LoadBalancer

image.png

kubectl -n kube-system edit nec 10.99.100.17

maxEip:1 => maxEip:30


标题:腾讯云 - pod独立IP并绑定CLB
地址:https://blog.njqhome.com:8443/articles/2022/07/20/1658316218729.html