Kubernetes - ucloud cube

2021-05-25

使用ucloud vk 实现使用kubernetes语法实现创建cube

kubectl label node uk8s-rmbeftl3-vk-tybtx test=true
apiVersion: v1
kind: Service
metadata:
  name: svc-squid-23888
  namespace: squid
  annotations:
    "service.beta.kubernetes.io/ucloud-load-balancer-id": "ulb-2bosvemp" #替换成自己的ULB Id
    "service.beta.kubernetes.io/ucloud-load-balancer-type": "outer"
    "service.beta.kubernetes.io/ucloud-load-balancer-vserver-protocol": "tcp"
spec:
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 23888
      targetPort: 23888
  selector:
    app: squid-23888
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: squid-23888
  namespace: squid
spec:
  replicas: 2
  selector:
    matchLabels:
      app: squid-23888
  template:
    metadata:
      labels:
        app: squid-23888
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: test
                operator: Exists
      containers:
      - name: squid
        image: uhub.service.ucloud.cn/yunquna/squid:3.5.28
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            cpu: 0.5
            memory: 1024Mi
        livenessProbe:
          failureThreshold: 3
          tcpSocket:
            port: 23888
          initialDelaySeconds: 3
          periodSeconds: 2
          successThreshold: 1
          timeoutSeconds: 1
      dnsPolicy: "None"
      dnsConfig:
          nameservers:
            - 100.90.90.90
            - 100.90.90.100
      tolerations:
        - effect: NoSchedule
          key: virtual-kubelet.io/provider
          operator: Equal
          value: ucloud
      imagePullSecrets:
      - name: ucloud-login-registry