kubernet的yaml实例
1、deploy.yaml
apiVersion: extensions/v1beta1 #apps/v1beta1 、apps/v1注意高版本可能需要后面这种配置 kind: Deployment metadata: name: chinapopin-framework namespace: chinapopin-system-prod labels: k8s-app: chinapopin-framework kubernetes.io/cluster-service: "true" kubernetes.io/name: chinapopin-framework spec: replicas: 6 selector: matchLabels: k8s-app: chinapopin-framework template: metadata: labels: k8s-app: chinapopin-framework annotations: scheduler.alpha.kubernetes.io/critical-pod: '' spec: serviceAccountName: chinapopin hostNetwork: false hostAliases: - ip: "100.98.100.242" hostnames: - "chinapopin.com" - "www.chinapopin.com" - ip: "183.57.48.62" hostnames: - "api.weixin.qq.com" imagePullSecrets: - name: docker-registry-secret containers: - name: chinapopin-framework-prod image: chinapopin.com:18443/popin/framework-web:3.10.13 imagePullPolicy: Always resources: limits: memory: 1536Mi requests: memory: 256Mi env: - name: "POPIN_JAVA_OPTS" value: "-Xms512m -Xmx1024m" ports: - containerPort: 80 protocol: TCP livenessProbe: httpGet: path: /framework/health port: 80 initialDelaySeconds: 120 timeoutSeconds: 15 tolerations: - key: "CriticalAddonsOnly" operator: "Exists"
2、server-Ingress.yaml
apiVersion: v1 kind: Service metadata: name: chinapopin-manager-ui namespace: chinapopin-system-prod labels: k8s-app: chinapopin-manager-ui kubernetes.io/cluster-service: "true" kubernetes.io/name: chinapopin-manager-ui spec: selector: k8s-app: chinapopin-manager-ui ports: - port: 80 targetPort: 80 --- apiVersion: extensions/v1beta1 kind: Ingress metadata: name: chinapopin-manager-ui-ingress namespace: chinapopin-system-prod annotations: kubernetes.io/ingress.class: traefik spec: rules: - host: manager-ui.popin.local http: paths: - path: /manager backend: serviceName: chinapopin-manager-ui servicePort: 80
做一个决定,并不难,难的是付诸行动,并且坚持到底。