Kubernetes-問題


問題1:

  • kube-apiserver: E0309 14:25:24.889084 66289 instance.go:392] Could not construct pre-rendered responses for ServiceAccountIssuerDiscovery endpoints. Endpoints will not be enabled. Error: issuer URL must use https scheme, got: api
  • kube-apiserver: E0309 14:26:21.064219 66289 controller.go:184] Get "https://10.1.1.11:6443/api/v1/namespaces/default/endpoints/kubernetes": dial tcp 10.1.1.11:6443: connect: connection refused

解決問題:

vim /usr/local/k8s/apiserver/conf/apiserver.conf
--service-account-signing-key-file=/usr/local/k8s/ca/ca-key.pem \
--service-account-issuer=https://kubernetes.default.svc.cluster.local \

問題2:

  • Unable to remove old endpoints from kubernetes service: StorageError: key not found, Code: 1, Key: /registry/masterleases/10.1.1.11, ResourceVersion: 0, AdditionalErrorMsg:

解決問題:

  • 可以從下面的圖片中看出,停止服務的時候key被刪掉了,但啟動的時候又要去獲取。

問題3:pod中的時間分區和宿主機的不同

解決問題方法一:配置環境變量

apiVersion: apps/v1
kind: Deployment
metadata:
spec:
  template:
    spec:
      containers:
        env:
        - name: TZ    #添加該環境變量
          value: Asia/Shanghai

解決問題方法二:掛載時間文件

apiVersion: apps/v1
kind: Deployment
metadata:
spec:
  template:
    spec:
      containers:
        volumeMounts:
        - name: time-mount
          mountPath: /etc/localtime    #將Asia/Shanghai掛載的容器中
      volumes:
      - name: time-mount
        hostPath:
          path: /usr/share/zoneinfo/Asia/Shanghai    #也可以使用軟鏈:/etc/localtime

問題4:創建的ingress不正常

問題描述:

  • ingress-nginx-controller-v1.0.4安裝正常
    • W0406 16:14:36.130966       6 client_config.go:615] Neither --kubeconfig nor --master was specified.  Using the inCluster報錯不用管。
  • 創建的ingress有問題
//ADDRESS沒有獲取地址
]# kubectl get ingress -o wide
NAME         CLASS    HOSTS       ADDRESS   PORTS   AGE
my-ingress   <none>   localhost             80      118s

//日志開頭雖然是I,但是它是有問題的
]# kubectl logs ingress-nginx-controller-5767958868-k9576  -n ingress-nginx
I0407 01:03:50.088521       6 store.go:342] "Ignoring ingress because of error while validating ingress class" ingress="default/my-ingress" error="ingress does not contain a valid IngressClass"

解決問題:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: "nginx"    #加上該注解
spec:

1

#                                                                                                                          #


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM