martes, 17 de septiembre de 2024

Check the status of kubernetes

To check current pods:

[ec2-user@ip-172-31-80-45 ~]$ kubectl get pod
NAME                                 READY   STATUS    RESTARTS       AGE
mongo-deployment-77f8f85dc8-cvz9j    1/1     Running   1 (126m ago)   139m
webapp-deployment-655ff6696b-vw5lw   1/1     Running   1 (7m1s ago)   138m


To check all pods, services and deployments:
[ec2-user@ip-172-31-80-45 ~]$ kubectl get all
NAME                                     READY   STATUS    RESTARTS       AGE
pod/mongo-deployment-77f8f85dc8-cvz9j    1/1     Running   1 (132m ago)   145m
pod/webapp-deployment-655ff6696b-vw5lw   1/1     Running   1 (13m ago)    144m
NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/kubernetes       ClusterIP   10.96.0.1       <none>        443/TCP          4h17m
service/mongo-service    ClusterIP   10.103.48.93    <none>        8080/TCP         155m
service/webapp-service   NodePort    10.109.94.172   <none>        3000:30100/TCP   144m
NAME                                READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/mongo-deployment    1/1     1            1           145m
deployment.apps/webapp-deployment   1/1     1            1           144m
NAME                                           DESIRED   CURRENT   READY   AGE
replicaset.apps/mongo-deployment-77f8f85dc8    1         1         1       145m
replicaset.apps/webapp-deployment-655ff6696b   1         1         1       144m


To check the current configmap:

[ec2-user@ip-172-31-80-45 ~]$ kubectl get configmap
NAME               DATA   AGE
game-demo          1      170m
kube-root-ca.crt   1      4h32m
mongo-config       1      164m


To check the current secrets:
[ec2-user@ip-172-31-80-45 ~]$ kubectl get secrets
NAME           TYPE     DATA   AGE
mongo-secret   Opaque   2      170m



To check the service's data:

[ec2-user@ip-172-31-80-45 ~]$ kubectl describe service webapp-service
Name: webapp-service
Namespace: default
Labels: <none>
Annotations: <none>
Selector: app=webapp
Type: NodePort
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.109.94.172
IPs: 10.109.94.172
Port: <unset> 3000/TCP
TargetPort: 3000/TCP
NodePort: <unset> 30100/TCP
Endpoints: 10.244.0.6:3000
Session Affinity: None
External Traffic Policy: Cluster
Internal Traffic Policy: Cluster
Events: <none>


To check the pod's data:

[ec2-user@ip-172-31-80-45 ~]$ kubectl describe pod mongo-deployment-77f8f85dc8-cvz9j
Name: mongo-deployment-77f8f85dc8-cvz9j
Namespace: default
Priority: 0
Service Account: default
Node: minikube/192.168.49.2
Start Time: Tue, 17 Sep 2024 20:42:27 +0000
Labels: app=mongo
pod-template-hash=77f8f85dc8
Annotations: <none>
Status: Running
IP: 10.244.0.7
IPs:
IP: 10.244.0.7
Controlled By: ReplicaSet/mongo-deployment-77f8f85dc8
Containers:
mongo:
Container ID: docker://9b4e7fc09ae6ac02df14283196c57c5826afcf00659e51e8fb37e92ced31fdc0
Image: mongo:5.0
Image ID: docker-pullable://mongo@sha256:fd08cf3c5aae3268a032a7064c60a4bc0fb468ee9a7b6b1b45b9b2335e4fda3e
Port: 27017/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 17 Sep 2024 22:54:42 +0000
Last State: Terminated
Reason: Completed
Exit Code: 0
Started: Tue, 17 Sep 2024 20:42:37 +0000
Finished: Tue, 17 Sep 2024 20:54:48 +0000
Ready: True
Restart Count: 1
Environment:
MONGO_INITD_ROOT_USERNAME: <set to the key 'mongo-user' in secret 'mongo-secret'> Optional: false
MONGO_INITD_ROOT_PASSWORD: <set to the key 'mongo-password' in secret 'mongo-secret'> Optional: false
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-pm8q8 (ro)
Conditions:
Type Status
PodReadyToStartContainers True

Initialized True

Ready True

ContainersReady True

PodScheduled True

Volumes:
kube-api-access-pm8q8:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 178m default-scheduler Successfully assigned default/mongo-deployment-77f8f85dc8-cvz9j to minikube
Normal Pulling 178m kubelet Pulling image "mongo:5.0"
Normal Pulled 177m kubelet Successfully pulled image "mongo:5.0" in 8.868s (8.868s including waiting). Image size: 723535501 bytes.
Normal Created 177m kubelet Created container mongo
Normal Started 177m kubelet Started container mongo
Normal SandboxChanged 45m kubelet Pod sandbox changed, it will be killed and re-created.
Normal Pulled 45m kubelet Container image "mongo:5.0" already present on machine
Normal Created 45m kubelet Created container mongo
Normal Started 45m kubelet Started container mongo


To check the logs of a pod:

[ec2-user@ip-172-31-80-45 ~]$ kubectl logs pod/mongo-deployment-77f8f85dc8-cvz9j

{"t":{"$date":"2024-09-17T22:54:43.121+00:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2024-09-17T22:54:43.136+00:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2024-09-17T22:54:43.147+00:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}


{"t":{"$date":"2024-09-17T22:54:43.149+00:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}

To check the service:

[ec2-user@ip-172-31-80-45 ~]$ kubectl get service
NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes       ClusterIP   10.96.0.1       <none>        443/TCP          4h54m
mongo-service    ClusterIP   10.103.48.93    <none>        8080/TCP         3h11m
webapp-service   NodePort    10.109.94.172   <none>        3000:30100/TCP   3h


To see the Minikube ip:
[ec2-user@ip-172-31-80-45 ~]$ minikube ip
192.168.49.2

If you are using a deployment of kubernetes, you can check date of the node:
[ec2-user@ip-172-31-80-45 ~]$ kubectl get node -o wide
NAME       STATUS   ROLES           AGE     VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION                    CONTAINER-RUNTIME
minikube   Ready    control-plane   4h55m   v1.31.0   192.168.49.2   <none>        Ubuntu 22.04.4 LTS   6.1.109-118.189.amzn2023.x86_64   docker://27.2.0


To check the endpoints
[ec2-user@ip-172-31-80-45 ~]$ kubectl get endpoints
NAME ENDPOINTS AGE
kubernetes 192.168.49.2:8443 5h40m
mongo-service 10.244.0.7:27017 3h57m
webapp-service 10.244.0.6:3000 3h46m

No hay comentarios:

Publicar un comentario