求问, pipeline流水线执行shell 执行 docker 总是报这个错误怎么解决,我已经更改了挂载到 /var/lib/containers目录下
Cannot connect to the Docker daemon at unix:///var/run/docker.sock
执行 kubectl -n kubesphere-system get deployment ks-apiserver -o yaml ,
/var/run/docker.sock不存在因次改成 /var/lib/docker.sock,但是流水线仍然使用/var/run/docker.sock
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: “26”
kubectl.kubernetes.io/last-applied-configuration: |
{“apiVersion”:“apps/v1”,“kind”:“Deployment”,“metadata”:{“annotations”:{},“labels”:{“app”:“ks-apiserver”,“tier”:“backend”,“version”:“v3.0.0”},“name”:“ks-apiserver”,“namespace”:“kubesphere-system”},“spec”:{“replicas”:3,“selector”:{“matchLabels”:{“app”:“ks-apiserver”,“tier”:“backend”,“version”:“v3.0.0”}},“strategy”:{“rollingUpdate”:{“maxSurge”:0},“type”:“RollingUpdate”},“template”:{“metadata”:{“labels”:{“app”:“ks-apiserver”,“tier”:“backend”,“version”:“v3.0.0”}},“spec”:{“affinity”:{“nodeAffinity”:{“preferredDuringSchedulingIgnoredDuringExecution”:[{“preference”:{“matchExpressions”:[{“key”:“node-role.kubernetes.io/master”,“operator”:“In”,“values”:[""]}]},“weight”:100}]},“podAntiAffinity”:{“requiredDuringSchedulingIgnoredDuringExecution”:[{“labelSelector”:{“matchExpressions”:[{“key”:“app”,“operator”:“In”,“values”:[“ks-apiserver”]}]},“namespaces”:[“kubesphere-system”],“topologyKey”:“kubernetes.io/hostname”}]}},“containers”:[{“command”:[“ks-apiserver”,“–logtostderr=true”],“image”:“kubesphere/ks-apiserver:v3.0.0”,“imagePullPolicy”:“IfNotPresent”,“livenessProbe”:{“failureThreshold”:8,“httpGet”:{“path”:“/kapis/version”,“port”:9090,“scheme”:“HTTP”},“initialDelaySeconds”:15,“timeoutSeconds”:15},“name”:“ks-apiserver”,“ports”:[{“containerPort”:9090,“protocol”:“TCP”}],“resources”:{“limits”:{“cpu”:1,“memory”:“1024Mi”},“requests”:{“cpu”:“20m”,“memory”:“100Mi”}},“volumeMounts”:[{“mountPath”:“/var/run/docker.sock”,“name”:“docker-sock”},{“mountPath”:“/etc/kubesphere/ingress-controller”,“name”:“ks-router-config”},{“mountPath”:“/etc/kubesphere/”,“name”:“kubesphere-config”},{“mountPath”:“/etc/localtime”,“name”:“host-time”}]}],“serviceAccount”:“kubesphere”,“serviceAccountName”:“kubesphere”,“tolerations”:[{“effect”:“NoSchedule”,“key”:“node-role.kubernetes.io/master”},{“key”:“CriticalAddonsOnly”,“operator”:“Exists”},{“effect”:“NoExecute”,“key”:“node.kubernetes.io/not-ready”,“operator”:“Exists”,“tolerationSeconds”:60},{“effect”:“NoExecute”,“key”:“node.kubernetes.io/unreachable”,“operator”:“Exists”,“tolerationSeconds”:60}],“volumes”:[{“hostPath”:{“path”:“/var/run/docker.sock”,“type”:""},“name”:“docker-sock”},{“configMap”:{“defaultMode”:420,“name”:“ks-router-config”},“name”:“ks-router-config”},{“configMap”:{“defaultMode”:420,“name”:“kubesphere-config”},“name”:“kubesphere-config”},{“hostPath”:{“path”:“/etc/localtime”,“type”:""},“name”:“host-time”}]}}}}
creationTimestamp: “2021-04-26T00:31:36Z”
generation: 26
labels:
app: ks-apiserver
tier: backend
version: v3.0.0
name: ks-apiserver
namespace: kubesphere-system
resourceVersion: “590889”
selfLink: /apis/apps/v1/namespaces/kubesphere-system/deployments/ks-apiserver
uid: b5fbb79b-70a0-49a6-bc67-2d307a48ef0c
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
app: ks-apiserver
tier: backend
version: v3.0.0
strategy:
rollingUpdate:
maxSurge: 0
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
kubectl.kubernetes.io/restartedAt: “2021-04-27T02:26:32Z”
creationTimestamp: null
labels:
app: ks-apiserver
tier: backend
version: v3.0.0
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: node-role.kubernetes.io/master
operator: In
values:
- ""
weight: 100
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- ks-apiserver
namespaces:
- kubesphere-system
topologyKey: kubernetes.io/hostname
containers:
- command:
- ks-apiserver
- –logtostderr=true
image: kubesphere/ks-apiserver:v3.0.0
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 8
httpGet:
path: /kapis/version
port: 9090
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 15
name: ks-apiserver
ports:
- containerPort: 9090
protocol: TCP
resources:
limits:
cpu: “1”
memory: 1Gi
requests:
cpu: 20m
memory: 100Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/lib/containers
name: docker-sock
- mountPath: /etc/kubesphere/ingress-controller
name: ks-router-config
- mountPath: /etc/kubesphere/
name: kubesphere-config
- mountPath: /etc/localtime
name: host-time
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: kubesphere
serviceAccountName: kubesphere
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 60
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 60
volumes:
- hostPath:
path: /var/lib/containers
type: ""
name: docker-sock
- configMap:
defaultMode: 420
name: ks-router-config
name: ks-router-config
- configMap:
defaultMode: 420
name: kubesphere-config
name: kubesphere-config
- hostPath:
path: /etc/localtime
type: ""
name: host-time
status:
availableReplicas: 3
conditions:
- lastTransitionTime: “2021-04-27T04:46:01Z”
lastUpdateTime: “2021-04-27T04:46:01Z”
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: “True”
type: Available - lastTransitionTime: “2021-04-26T00:31:36Z”
lastUpdateTime: “2021-04-27T04:46:14Z”
message: ReplicaSet “ks-apiserver-6b498795b9” has successfully progressed.
reason: NewReplicaSetAvailable
status: “True”
type: Progressing
observedGeneration: 26
readyReplicas: 3
replicas: 3
updatedReplicas: 3
已经解决,升级集群,将节点由 containered 改为 docker
containered 不支持 /var/run/docker.sock