退了没看见 發表於 2022-4-7 01:31:00

Kubernetes-问题

<h3>问题1:</h3>
<ul>
<li>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</li>
<li>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</li>
</ul>
<p>解决问题:</p>
<div class="cnblogs_Highlighter">
<pre class="brush:bash;gutter:true;">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 \</pre>
</div>
<h3>问题2:</h3>
<ul>
<li>Unable to remove old endpoints from kubernetes service: StorageError: key not found, Code: 1, Key: /registry/masterleases/10.1.1.11, ResourceVersion: 0, AdditionalErrorMsg:</li>
</ul>
<p>解决问题:</p>
<ul>
<li>可以从下面的图片中看出,停止服务的时候key被删掉了,但启动的时候又要去获取。</li>
</ul>
<p><img src="https://img2022.cnblogs.com/blog/2270526/202203/2270526-20220311004041005-1053370636.png" alt="" loading="lazy"></p>
<h3>问题3:pod中的时间分区和宿主机的不同</h3>
<p>解决问题方法一:配置环境变量</p>
<div class="cnblogs_Highlighter">
<pre class="brush:bash;gutter:true;">apiVersion: apps/v1
kind: Deployment
metadata:
spec:
template:
    spec:
      containers:
      env:
      - name: TZ    #添加该环境变量
          value: Asia/Shanghai</pre>
</div>
<p>解决问题方法二:挂载时间文件</p>
<div class="cnblogs_Highlighter">
<pre class="brush:bash;gutter:true;">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</pre>
</div>
<h3>问题4:创建的ingress不正常</h3>
<p>问题描述:</p>
<ul>
<li>ingress-nginx-controller-v1.0.4安装正常
<ul>
<li>W0406 16:14:36.130966&nbsp; &nbsp; &nbsp; &nbsp;6 client_config.go:615] Neither --kubeconfig nor --master was specified.&nbsp; Using the inCluster报错不用管。</li>
</ul>
</li>
<li>创建的ingress有问题</li>
</ul>
<div class="cnblogs_Highlighter">
<pre class="brush:php;gutter:true;">//ADDRESS没有获取地址
]# kubectl get ingress -o wide
NAME         CLASS    HOSTS       ADDRESS   PORTS   AGE
my-ingress   &lt;none&gt;   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"</pre>
</div>
<p>解决问题:</p>
<div class="cnblogs_Highlighter">
<pre class="brush:bash;gutter:true;">apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
    kubernetes.io/ingress.class: "nginx"    #加上该注解
spec:</pre>
</div>
<p>1</p>
<div class="cnblogs_Highlighter">
<pre class="brush:bash;gutter:true;">#                                                                                                                        #</pre>
</div><br><br>
来源:https://www.cnblogs.com/maiblogs/p/15991998.html
頁: [1]
查看完整版本: Kubernetes-问题