How to view the logs before Pod crash in K8s

Scene When the pod is in the crash state, the container keeps restarting. At this time, using kubelet logs may never capture the logs. Solution: kubectl previous Parameter function: If true, print the logs for the previous instance of the container in a pod if it exists. Single container pod: kubectl logs pod-name –previous Multi-container […]

[Building Prometheus monitoring from scratch] Section 5: Installing Prometheus on k8s and indicator optimization

Article directory Preface Install Prometheus on Kubernetes StatefulSet is configuring Detailed explanation of configmap configuration and indicator collection optimization ideas How to filter indicators (optimize indicator volume) How to get all k8s metrics? start up View metrics Foreword In our Prometheus monitoring architecture, the main role of prometheus on k8s is to monitor k8s resources, […]

K8S cluster deployment: Guide to deploying k8s 1.26 cluster using kubespray

kubespray deploys k8s 1.26 cluster https://github.com/kubernetes-sigs/kubespray Host list Host Name IP Address Hardware Configuration Host Role k8s-master01 192.168.10.160/24 4C4G1T master k8s-master02 192.168.10.161/24 4C4G1T master k8s-master03 192.168.10.162/24 4C4G1T master k8s-worker01 192.168.10.163/24 4C4G1T worker k8s-worker02 192.168.10.164/24 4C4G1T worker kubespray 192.168.10.165/24 4C4G1T ansible Host name resolution # cat /etc/hosts 192.168.10.160 k8s-master01 192.168.10.161 k8s-master02 192.168.10.162 k8s-master03 192.168.10.163 k8s-worker01 192.168.10.164 […]

kubernetes cluster orchestration – k8s storage (configmap, secrets)

configmap Literal value creation kubectl create configmap my-config –from-literal=key1=config1 –from-literal=key2=config2 kubectl get cm kubectl describe cm my-config Create from file kubectl create configmap my-config-2 –from-file=/etc/resolv.conf kubectl describe cm my-config-2 Create from directory mkdir test cp /etc/passwd test/ cp /etc/fstab test/ ls test/ kubectl create configmap my-config-3 –from-file=test kubectl describe cm my-config-3 Created through yaml file […]

k8s multi-network card solution multus

Multus_CNI deployment and basic use of kubernetes multi-network card solution 1. The background of the emergence of multus cni When you start a container in a k8s environment, there are only two virtual network interfaces (loopback and eth0) by default. The loopback traffic will always circulate in this container or on the local machine. It […]

K8s Error: ImagePullBackOff Troubleshooting

Error: ImagePullBackOff Troubleshooting 1. Cause The reason was to conduct a Prometheus test in a set of k8s environments. At that time, the virtual machine was directly suspended after running out. After starting the master and node nodes, restart these nodes. When checking the dashboard, it is found that the Pod is in the ImagePullBackOff […]

The namespace status in the k8s cluster always shows Terminating

1. Problem phenomenon When I was doing testing today, I couldn’t start the pod in a namespace. When I checked the ns status, it kept showing Terminating. [root@node1 ~]# kubectl get ns NAME STATUS AGE configmap Terminating 135d defaultActive 207d Harbor Active 207d kube-flannel Terminating 17m kube-node-lease Active 207d kube-public Active 207d kube-system Active 207d […]

[k8s] Resource management commands-declarative

1. Introduction to yaml and json 1. Yuml language introduction YAML is a markup language similar to XML and JSON. It emphasizes data as the center and does not focus on markup language. The definition of YAML itself is relatively simple. Known as “a humanized data format language”. The syntax of YAML is relatively simple, […]

k8s mysql master-slave replication (with password) ubuntu arm kernel

Install NFS service ## Installation sudo apt install nfs-kernel-server ## start up sudo /etc/init.d/nfs-kernel-server start ## Create a directory mkdir /data/nfs sudo chmod -R 777 /data/nfs ## Share nano /etc/exports ## Add to end of file /var/nfs *(insecure,rw,sync,no_root_squash) ## Restart sudo /etc/init.d/nfs-kernel-server restart Install Helm ## Installation curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash ## Add and modify […]