tech:notes_kubernetes_k8s_-_pb
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:notes_kubernetes_k8s_-_pb [2025/11/09 19:11] – Jean-Baptiste | tech:notes_kubernetes_k8s_-_pb [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes Kubernetes k8s - Pb | ||
| + | |||
| + | |||
| + | ## kind - ErrImageNeverPull | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | |||
| + | ~~~bash | ||
| + | kind load docker-image hello-python: | ||
| + | |||
| + | kubectl apply -f deployment.yaml | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | # kubectl get pods -o wide | ||
| + | NAME READY | ||
| + | hello-python-67978d6b66-spc7d | ||
| + | hello-python-67978d6b66-vmv27 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Solution | ||
| + | |||
| + | `crictl images` est équivalent à `docker images` | ||
| + | |||
| + | Diag: | ||
| + | ~~~ | ||
| + | root@vmdeb01: | ||
| + | root@kind-control-plane:/# | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | kubectl delete deployment hello-python | ||
| + | |||
| + | docker build -f Dockerfile -t hello-python: | ||
| + | kind load docker-image hello-python: | ||
| + | ~~~ | ||
| + | |||
| + | `deployment.yaml` | ||
| + | ~~~yaml | ||
| + | apiVersion: v1 | ||
| + | kind: Service | ||
| + | metadata: | ||
| + | name: hello-python-service | ||
| + | spec: | ||
| + | | ||
| + | app: hello-python | ||
| + | | ||
| + | - protocol: " | ||
| + | port: 6000 | ||
| + | | ||
| + | type: LoadBalancer | ||
| + | |||
| + | --- | ||
| + | apiVersion: apps/v1 | ||
| + | kind: Deployment | ||
| + | metadata: | ||
| + | name: hello-python | ||
| + | spec: | ||
| + | | ||
| + | | ||
| + | app: hello-python | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | app: hello-python | ||
| + | spec: | ||
| + | | ||
| + | - name: hello-python | ||
| + | # | ||
| + | | ||
| + | | ||
| + | | ||
| + | - containerPort: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Pb Status Error | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | |||
| + | ~~~ | ||
| + | root@vmdeb01: | ||
| + | NAME READY | ||
| + | hello-python-7954bd58df-7qhj6 | ||
| + | hello-python-7954bd58df-v4bmx | ||
| + | ~~~ | ||
| + | |||
| + | # # kubectl logs hello-python-7954bd58df-7qhj6 -c < | ||
| + | # kubectl logs hello-python-7954bd58df-7qhj6 | ||
| + | python: can't open file '/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | kubectl get pods -l app=myapp-deployment | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ## Pb Kubeadm 2 | ||
| + | |||
| + | ~~~ | ||
| + | kubeadm join vmdeb02: | ||
| + | [preflight] Running pre-flight checks | ||
| + | |||
| + | |||
| + | error execution phase preflight: couldn' | ||
| + | To see the stack trace of this error execute with --v=5 or higher | ||
| + | ~~~ | ||
| + | |||
| + | Le port 6443 n'est pas en écoute sur le Master | ||
| + | |||
| + | |||
| + | ### Solution | ||
| + | |||
| + | Sur le master | ||
| + | ~~~bash | ||
| + | kubeadm reset | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | kubeadm init --control-plane-endpoint=192.168.100.12: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Pb réseau pod still ContainerCreating starte | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | |||
| + | ~~~ | ||
| + | # kubectl get pods -n kube-system | egrep -v " | ||
| + | NAME READY | ||
| + | coredns-76f75df574-4pqxw | ||
| + | coredns-76f75df574-lfdvp | ||
| + | weave-net-f9p5b | ||
| + | weave-net-qj9zd | ||
| + | |||
| + | root@vmdeb02: | ||
| + | Warning | ||
| + | Warning | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Forbiden | ||
| + | |||
| + | ~~~ | ||
| + | "Error from server (Forbidden): | ||
| + | s forbidden: unable to create new content in namespace kubernetes-dashboard because it is being terminated" | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Solution | ||
| + | |||
| + | ~~~bash | ||
| + | kubectl -n kubernetes-dashboard delete pod,svc --all | ||
| + | kubectl -n kubernetes-dashboard delete pod,svc --all --force --grace-period 0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## Pb access Kubernetes Dashboard Error trying to reach service: 'dial tcp 10.244.2.4: | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | ssh -L8001: | ||
| + | sudo kubectl proxy | ||
| + | ~~~ | ||
| + | |||
| + | http:// | ||
| + | ~~~ | ||
| + | Error trying to reach service: 'dial tcp 10.244.2.8: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## Kubernetes-dashboard | ||
| + | |||
| + | ~~~bash | ||
| + | kubectl --namespace=kubernetes-dashboard port-forward kubernetes-dashboard-b7ffbc8cb-2kwxp 8443 | ||
| + | curl 127.0.0.1: | ||
| + | ~~~ | ||
| + | |||
| + | ### Solution | ||
| + | |||
| + | ~~~bash | ||
| + | ssh -L8443: | ||
| + | ~~~ | ||
| + | |||
| + | https:// | ||
| + | |||
| + | Après nous avons le choix : | ||
| + | * Please select the kubeconfig file that you have created to configure access to the cluster. To find out more about how to configure and use kubeconfig file, please refer to the [Configure Access to Multiple Clusters](https:// | ||
| + | * Every Service Account has a Secret with valid Bearer Token that can be used to log in to Dashboard. To find out more about how to configure and use Bearer Tokens, please refer to the [Authentication](https:// | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ## Pb l' | ||
| + | |||
| + | ~~~ | ||
| + | $ kubectl get services nginx-web-svc | ||
| + | NAME TYPE | ||
| + | nginx-web-svc | ||
| + | ~~~ | ||
| + | |||
| + | Probablement qu'il n'y a pas de Ingress controller. | ||
| + | |||
| + | ### Solution : NodePort | ||
| + | |||
| + | ~~~bash | ||
| + | kubectl edit services nginx-web-svc | ||
| + | ~~~ | ||
| + | |||
| + | Changer | ||
| + | `type: LoadBalancer` en `type: NodePort` | ||
| + | |||
| + | Voir aussi `type: ClusterIP` | ||
| + | |||
| + | |||
| + | |||
| + | ## Pb Metrics-server - tls: failed to verify certificate: | ||
| + | |||
| + | ~~~ | ||
| + | $ kubectl -n kube-system describe deploy metrics-server | grep ^Selector: | ||
| + | Selector: | ||
| + | |||
| + | $ kubectl -n kube-system get pods -l k8s-app=metrics-server | ||
| + | NAME READY | ||
| + | metrics-server-587b667b55-wt67b | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | metrics-server-587b667b55-wt67b -n kube-system | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | I0924 21: | ||
| + | E0924 21: | ||
| + | E0924 21: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ### Solution | ||
| + | |||
| + | ~~~bash | ||
| + | kubectl patch deployment metrics-server -n kube-system --type ' | ||
| + | ~~~ | ||
| + | |||
| + | ou | ||
| + | |||
| + | ~~~bash | ||
| + | kubectl edit deploy metrics-server -n kube-system | ||
| + | ~~~ | ||
| + | |||
| + | ~~~yaml | ||
| + | spec: | ||
| + | progressDeadlineSeconds: | ||
| + | replicas: 1 | ||
| + | revisionHistoryLimit: | ||
| + | selector: | ||
| + | matchLabels: | ||
| + | k8s-app: metrics-server | ||
| + | strategy: | ||
| + | rollingUpdate: | ||
| + | maxSurge: 25% | ||
| + | maxUnavailable: | ||
| + | type: RollingUpdate | ||
| + | template: | ||
| + | metadata: | ||
| + | creationTimestamp: | ||
| + | labels: | ||
| + | k8s-app: metrics-server | ||
| + | spec: | ||
| + | containers: | ||
| + | - args: | ||
| + | - --cert-dir=/ | ||
| + | - --secure-port=10250 | ||
| + | - --kubelet-preferred-address-types=InternalIP, | ||
| + | - --kubelet-use-node-status-port | ||
| + | - --metric-resolution=15s | ||
| + | - --kubelet-insecure-tls | ||
| + | ~~~ | ||
| + | |||
| + | http:// | ||
| + | |||
| + | |||
| + | #### Autres | ||
| + | |||
| + | `--kubelet-preferred-address-types=InternalIP` | ||
| + | |||
| + | |||
| + | |||
| + | |||
