본문 바로가기
IT 기술/k8s

[cka] Deploy Network Solution

by Geunny 2024. 8. 9.
반응형

1. In this practice test we will install weave-net POD networking solution to the cluster. Let us first inspect the setup. We have deployed an application called app in the default namespace. What is the state of the pod?

 

controlplane ~ ➜  k get pods
NAME   READY   STATUS              RESTARTS   AGE
app    0/1     ContainerCreating   0          76s

 

answer : NotRunning

 

2. Inspect why the POD is not running.

controlplane ~ ➜  k describe pod app 
Name:             app
Namespace:        default
Priority:         0
Service Account:  default
...
Events:
  Type     Reason                  Age                   From               Message
  ----     ------                  ----                  ----               -------
  Normal   Scheduled               2m42s                 default-scheduler  Successfully assigned default/app to controlplane
  Warning  FailedCreatePodSandBox  2m42s                 kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "025518421ee25873a6d5b790b5326c17d61aa21d3e45b8ca627aa31c6069c822": plugin type="weave-net" name="weave" failed (add): unable to allocate IP address: Post "http://127.0.0.1:6784/ip/025518421ee25873a6d5b790b5326c17d61aa21d3e45b8ca627aa31c6069c822": dial tcp 127.0.0.1:6784: connect: connection refused
  Normal   SandboxChanged          13s (x12 over 2m42s)  kubelet            Pod sandbox changed, it will be killed and re-created.

 

answer : No Network Configured

 

3. Deploy weave-net networking solution to the cluster. 

NOTE: - We already have provided a weave manifest file under the /root/weave directory.

 

controlplane ~ ➜  k apply -f /root/weave/weave-daemonset-k8s.yaml 
serviceaccount/weave-net created
clusterrole.rbac.authorization.k8s.io/weave-net created
clusterrolebinding.rbac.authorization.k8s.io/weave-net created
role.rbac.authorization.k8s.io/weave-net created
rolebinding.rbac.authorization.k8s.io/weave-net created
daemonset.apps/weave-net created

controlplane ~ ➜  k get pods -n kube-system 
NAME                                   READY   STATUS    RESTARTS   AGE
coredns-768b85b76f-6gjtz               1/1     Running   0          41m
coredns-768b85b76f-7j6js               1/1     Running   0          41m
etcd-controlplane                      1/1     Running   0          41m
kube-apiserver-controlplane            1/1     Running   0          41m
kube-controller-manager-controlplane   1/1     Running   0          41m
kube-proxy-x69z7                       1/1     Running   0          41m
kube-scheduler-controlplane            1/1     Running   0          41m
weave-net-xshjf                        2/2     Running   0          48s

controlplane ~ ➜  k get pods
NAME   READY   STATUS    RESTARTS   AGE
app    1/1     Running   0          5m53s

 

 

'IT 기술 > k8s' 카테고리의 다른 글

[cka] Service Networking  (0) 2024.08.09
[cka] Networking Weave  (0) 2024.08.09
[cka] CNI  (0) 2024.08.09
[cka] Explore Environment  (0) 2024.08.07
[cka] Storage Class  (0) 2024.08.06

댓글