Bài đăng

Đang hiển thị bài đăng từ Tháng 1, 2021

Một số lỗi vận hành k8s

Hình ảnh
  How to fix in Kubernetes – Deleting a PVC stuck in status “Terminating” The Issue Whilst working on a Kubernetes demo for a customer, I was cleaning up my environment and deleting persistent volume claims (PVC) that were no longer need. I noticed that one PVC was stuck in “terminating” status for quite a while. Note: I am using the OC commands in place of kubectl due to this being a Openshift environment The Cause I had a quick google and found I needed to verify if the PVC is still attached to a node in the cluster. kubectl get volumeattachment I could see it was, and the reason behind this was the configuration for the PVC was not fully updated during the delete process. The Fix I found the fix on this  github issue log  . You need to patch the PVC to set the “finalizers” setting to null, this allows the final unmount from the node, and the PVC can be deleted. kubectl patch pvc {PVC_NAME} -p '{"metadata":{"finalizers":null}}' Regards How to fix in Kuber...

Các cách đóng gói images để optimize

  Cách 1: Cài đặt đầy đủ phần mềm, kể cả các trình biên dịch và thư viện để compile source. Ưu điểm: - Cài đặt đơn giản - Build image nhanh vì sử dụng cơ chế cache layers. Nhược điểm: - Kích thước image lớn. VD: FROM ubuntu:16.04 #Install Nginx RUN apt-get update \     && apt-get install -y software-properties-common \     && apt-add-repository -y ppa:nginx/stable \     && apt-get update \     && apt-get install -y nginx \     && rm -rf /var/lib/apt/lists/* ADD nginx/nginx.conf /etc/nginx/nginx.conf ADD nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf ADD data/www /data/www RUN rm /etc/nginx/sites-enabled/default RUN ln -sf /dev/stdout /var/log/nginx/access.log \     && ln -sf /dev/stderr /var/log/nginx/error.log Cách 2: Thực hiện cài đặt trình biên dịch và thư viện để compile mã nguồn. Sau đó remove trình ...