Usr/sbin/mysqld cpu cao

Hướng dẫn này cung cấp hướng dẫn cơ bản về hệ thống điều phối cụm Kubernetes. Mỗi mô-đun chứa một số thông tin cơ bản về các tính năng và khái niệm chính của Kubernetes và bao gồm một hướng dẫn trực tuyến tương tác. Các hướng dẫn tương tác này cho phép bạn tự quản lý một cụm đơn giản và các ứng dụng được chứa trong đó

Sử dụng các hướng dẫn tương tác, bạn có thể học cách

  • Triển khai một ứng dụng được đóng gói trên một cụm
  • Mở rộng quy mô triển khai
  • Cập nhật ứng dụng được chứa bằng phiên bản phần mềm mới
  • Gỡ lỗi ứng dụng được chứa

Các hướng dẫn sử dụng Katacoda để chạy một thiết bị đầu cuối ảo trong trình duyệt web của bạn chạy Minikube, một triển khai cục bộ quy mô nhỏ của Kubernetes có thể chạy ở mọi nơi. Không cần cài đặt bất kỳ phần mềm nào hoặc định cấu hình bất kỳ thứ gì;


Kubernetes có thể làm gì cho bạn?

Với các dịch vụ web hiện đại, người dùng mong đợi các ứng dụng có sẵn 24/7 và các nhà phát triển mong muốn triển khai các phiên bản mới của các ứng dụng đó nhiều lần trong ngày. Containerization giúp đóng gói phần mềm để phục vụ các mục tiêu này, cho phép các ứng dụng được phát hành và cập nhật mà không có thời gian chết. Kubernetes giúp bạn đảm bảo các ứng dụng được đóng gói đó chạy ở đâu và khi nào bạn muốn, đồng thời giúp chúng tìm thấy các tài nguyên và công cụ cần thiết để hoạt động. Kubernetes là một nền tảng mã nguồn mở, sẵn sàng sản xuất được thiết kế với kinh nghiệm tích lũy của Google về điều phối vùng chứa, kết hợp với các ý tưởng hay nhất từ ​​cộng đồng

Bạn có thể cài đặt và sử dụng

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
7 trên nhiều loại máy khác nhau. máy tính xách tay của bạn, một bộ máy chủ đám mây, Raspberry Pi, v.v. Cho dù bạn đang triển khai trên đám mây hay tại chỗ, bạn có thể tích hợp
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
7 vào các hệ thống cung cấp như Ansible hoặc Terraform

Trước khi bắt đầu

Để làm theo hướng dẫn này, bạn cần

  • Một hoặc nhiều máy chạy hệ điều hành Linux tương thích với deb/rpm; . Ubuntu hoặc CentOS
  • RAM 2 GiB trở lên trên mỗi máy--bất kỳ dung lượng nào ít hơn sẽ để lại rất ít chỗ cho các ứng dụng của bạn
  • Ít nhất 2 CPU trên máy mà bạn sử dụng làm nút mặt phẳng điều khiển
  • Kết nối mạng đầy đủ giữa tất cả các máy trong cụm. Bạn có thể sử dụng mạng công cộng hoặc mạng riêng

Bạn cũng cần sử dụng phiên bản

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
7 có thể triển khai phiên bản Kubernetes mà bạn muốn sử dụng trong cụm mới của mình

Chính sách hỗ trợ lệch phiên bản và phiên bản của Kubernetes áp dụng cho

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
7 cũng như cho Kubernetes nói chung. Kiểm tra chính sách đó để tìm hiểu về phiên bản Kubernetes và
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
7 nào được hỗ trợ. Trang này được viết cho Kubernetes v1. 26

Trạng thái tính năng tổng thể của công cụ

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
7 là Tính khả dụng chung (GA). Một số tính năng phụ vẫn đang được phát triển tích cực. Việc triển khai tạo cụm có thể thay đổi một chút khi công cụ phát triển, nhưng việc triển khai tổng thể sẽ khá ổn định

Ghi chú. Theo định nghĩa, bất kỳ lệnh nào trong

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
7 đều được hỗ trợ ở cấp độ alpha

mục tiêu

  • Cài đặt một cụm Kubernetes mặt phẳng điều khiển duy nhất
  • Cài đặt mạng Pod trên cụm để các Pod của bạn có thể nói chuyện với nhau

Hướng dẫn

Chuẩn bị máy chủ

Cài đặt thời gian chạy vùng chứa và kubeadm trên tất cả các máy chủ. Để biết hướng dẫn chi tiết và các điều kiện tiên quyết khác, hãy xem Cài đặt kubeadm

Ghi chú

Nếu bạn đã cài đặt kubeadm, hãy chạy

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
8 hoặc
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
9 để tải phiên bản kubeadm mới nhất

Khi bạn nâng cấp, kubelet sẽ khởi động lại cứ sau vài giây khi nó đợi trong một vòng lặp sự cố để kubeadm cho biết phải làm gì. crashloop này được mong đợi và bình thường. Sau khi bạn khởi tạo mặt phẳng điều khiển, kubelet sẽ chạy bình thường

Chuẩn bị các hình ảnh vùng chứa cần thiết

Bước này là tùy chọn và chỉ áp dụng trong trường hợp bạn muốn

export KUBECONFIG=/etc/kubernetes/admin.conf
0 và
export KUBECONFIG=/etc/kubernetes/admin.conf
1 không tải xuống hình ảnh vùng chứa mặc định được lưu trữ tại
export KUBECONFIG=/etc/kubernetes/admin.conf
2

Kubeadm có các lệnh có thể giúp bạn kéo trước các hình ảnh cần thiết khi tạo một cụm không có kết nối internet trên các nút của nó. Xem Chạy kubeadm không cần kết nối internet để biết thêm chi tiết

Kubeadm cho phép bạn sử dụng kho lưu trữ hình ảnh tùy chỉnh cho các hình ảnh được yêu cầu. Xem Sử dụng hình ảnh tùy chỉnh để biết thêm chi tiết

Đang khởi tạo nút mặt phẳng điều khiển của bạn

Nút mặt phẳng điều khiển là máy chạy các thành phần của mặt phẳng điều khiển, bao gồm etcd (cơ sở dữ liệu cụm) và Máy chủ API (mà công cụ dòng lệnh kubectl giao tiếp với)

  1. (Được khuyến nghị) Nếu bạn có kế hoạch nâng cấp cụm
    Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    7 trên mặt phẳng điều khiển duy nhất này lên tính sẵn sàng cao, bạn nên chỉ định
    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    4 để đặt điểm cuối dùng chung cho tất cả các nút trên mặt phẳng điều khiển. Một điểm cuối như vậy có thể là tên DNS hoặc địa chỉ IP của bộ cân bằng tải
  2. Chọn một tiện ích bổ sung mạng Pod và xác minh xem nó có yêu cầu bất kỳ đối số nào được chuyển đến
    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    0 hay không. Tùy thuộc vào nhà cung cấp bên thứ ba mà bạn chọn, bạn có thể cần đặt
    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    6 thành giá trị dành riêng cho nhà cung cấp. Xem Cài đặt tiện ích bổ sung mạng Pod
  3. (Tùy chọn)
    Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    7 cố gắng phát hiện thời gian chạy vùng chứa bằng cách sử dụng danh sách các điểm cuối nổi tiếng. Để sử dụng thời gian chạy bộ chứa khác hoặc nếu có nhiều hơn một bộ chứa được cài đặt trên nút được cung cấp, hãy chỉ định đối số
    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    8 cho
    Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    7. Xem Cài đặt thời gian chạy
  4. (Tùy chọn) Trừ khi có quy định khác,
    Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    7 sử dụng giao diện mạng được liên kết với cổng mặc định để đặt địa chỉ quảng cáo cho máy chủ API của nút mặt phẳng điều khiển cụ thể này. Để sử dụng giao diện mạng khác, hãy chỉ định đối số
    Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    01 thành
    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    0. Để triển khai cụm Kubernetes IPv6 sử dụng địa chỉ IPv6, bạn phải chỉ định địa chỉ IPv6, ví dụ:
    Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    03

Để khởi chạy nút mặt phẳng điều khiển

Cân nhắc về apiserver-advertise-address và ControlPlaneEndpoint

Mặc dù có thể sử dụng

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
04 để đặt địa chỉ quảng cáo cho máy chủ API của nút mặt phẳng điều khiển cụ thể này, nhưng có thể sử dụng
export KUBECONFIG=/etc/kubernetes/admin.conf
4 để đặt điểm cuối dùng chung cho tất cả các nút mặt phẳng điều khiển

export KUBECONFIG=/etc/kubernetes/admin.conf
4 cho phép cả địa chỉ IP và tên DNS có thể ánh xạ tới địa chỉ IP. Vui lòng liên hệ với quản trị viên mạng của bạn để đánh giá các giải pháp khả thi đối với việc lập bản đồ đó

Đây là một ánh xạ ví dụ

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
6

Trong đó

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
07 là địa chỉ IP của nút này và
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
08 là tên DNS tùy chỉnh ánh xạ tới IP này. Điều này sẽ cho phép bạn chuyển
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
09 tới
export KUBECONFIG=/etc/kubernetes/admin.conf
0 và chuyển cùng tên DNS tới
export KUBECONFIG=/etc/kubernetes/admin.conf
1. Sau đó, bạn có thể sửa đổi
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
08 để trỏ đến địa chỉ của bộ cân bằng tải trong trường hợp có tính khả dụng cao

Việc chuyển một cụm mặt phẳng điều khiển duy nhất được tạo mà không có

export KUBECONFIG=/etc/kubernetes/admin.conf
4 thành một cụm có tính sẵn sàng cao không được kubeadm hỗ trợ

Thêm thông tin

Để biết thêm thông tin về đối số

export KUBECONFIG=/etc/kubernetes/admin.conf
0, hãy xem hướng dẫn tham khảo kubeadm

Để định cấu hình

export KUBECONFIG=/etc/kubernetes/admin.conf
0 bằng tệp cấu hình, hãy xem Sử dụng kubeadm init bằng tệp cấu hình

Để tùy chỉnh các thành phần của mặt phẳng điều khiển, bao gồm gán IPv6 tùy chọn cho đầu dò hoạt động cho các thành phần của mặt phẳng điều khiển và máy chủ etcd, hãy cung cấp các đối số bổ sung cho từng thành phần như được ghi lại trong các đối số tùy chỉnh

Để định cấu hình lại một cụm đã được tạo, hãy xem Định cấu hình lại cụm kubeadm

Để chạy lại

export KUBECONFIG=/etc/kubernetes/admin.conf
0, trước tiên bạn phải phá bỏ cụm

Nếu bạn tham gia một nút có kiến ​​trúc khác với cụm của mình, hãy đảm bảo rằng DaemonSets đã triển khai của bạn có hỗ trợ hình ảnh bộ chứa cho kiến ​​trúc này

Đầu tiên,

export KUBECONFIG=/etc/kubernetes/admin.conf
0 chạy một loạt kiểm tra trước để đảm bảo rằng máy đã sẵn sàng chạy Kubernetes. Những kiểm tra trước này đưa ra các cảnh báo và thoát khi có lỗi. Sau đó,
export KUBECONFIG=/etc/kubernetes/admin.conf
0 tải xuống và cài đặt các thành phần của mặt phẳng điều khiển cụm. Việc này có thể sẽ mất vài phút. Sau khi nó kết thúc, bạn sẽ thấy

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:

Để làm cho kubectl hoạt động cho người dùng không phải root của bạn, hãy chạy các lệnh này, đây cũng là một phần của đầu ra

export KUBECONFIG=/etc/kubernetes/admin.conf
0

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Ngoài ra, nếu bạn là người dùng

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
20, bạn có thể chạy

export KUBECONFIG=/etc/kubernetes/admin.conf

Cảnh báo. Kubeadm ký chứng chỉ trong

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
21 để có
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
22.
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
23 là một nhóm siêu người dùng siêu cấp vượt qua lớp ủy quyền (e. g. RBAC). Không chia sẻ tệp
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
21 với bất kỳ ai và thay vào đó cấp cho người dùng quyền tùy chỉnh bằng cách tạo cho họ tệp kubeconfig bằng lệnh
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
25. Để biết thêm chi tiết, hãy xem Tạo tệp kubeconfig cho người dùng bổ sung

Tạo một bản ghi của lệnh

export KUBECONFIG=/etc/kubernetes/admin.conf
1 mà đầu ra của
export KUBECONFIG=/etc/kubernetes/admin.conf
0. Bạn cần lệnh này để nối các nút vào cụm của mình

Mã thông báo được sử dụng để xác thực lẫn nhau giữa nút mặt phẳng điều khiển và các nút tham gia. Mã thông báo bao gồm ở đây là bí mật. Giữ an toàn vì bất kỳ ai có mã thông báo này đều có thể thêm các nút được xác thực vào cụm của bạn. Các mã thông báo này có thể được liệt kê, tạo và xóa bằng lệnh

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
28. Xem hướng dẫn tham khảo kubeadm

Cài đặt tiện ích bổ sung mạng Pod

thận trọng

Phần này chứa thông tin quan trọng về thiết lập mạng và thứ tự triển khai. Đọc tất cả các lời khuyên này một cách cẩn thận trước khi tiếp tục

Bạn phải triển khai tiện ích bổ sung mạng Pod dựa trên Giao diện mạng vùng chứa (CNI) để các Pod của bạn có thể giao tiếp với nhau. Cluster DNS (CoreDNS) sẽ không khởi động trước khi mạng được cài đặt

  • Hãy cẩn thận rằng mạng Pod của bạn không được trùng lặp với bất kỳ mạng máy chủ nào. bạn có thể gặp vấn đề nếu có bất kỳ sự trùng lặp nào. (Nếu bạn thấy xung đột giữa mạng Pod ưa thích của plugin mạng và một số mạng máy chủ của mình, bạn nên nghĩ đến một khối CIDR phù hợp để sử dụng thay thế, sau đó sử dụng khối đó trong thời gian

    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    0 với
    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    6 và thay thế trong YAML của plugin mạng của bạn)

  • Theo mặc định,

    Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    7 thiết lập cụm của bạn để sử dụng và thực thi việc sử dụng RBAC (kiểm soát truy cập dựa trên vai trò). Đảm bảo rằng plugin mạng Pod của bạn hỗ trợ RBAC và bất kỳ bảng kê khai nào bạn sử dụng để triển khai nó cũng vậy

  • Nếu bạn muốn sử dụng IPv6--chỉ mạng IPv6 ngăn xếp kép hoặc ngăn xếp đơn--cho cụm của mình, hãy đảm bảo rằng plugin mạng Pod của bạn hỗ trợ IPv6. Hỗ trợ IPv6 đã được thêm vào CNI trong v0. 6. 0

Ghi chú. Kubeadm phải là CNI bất khả tri và việc xác thực các nhà cung cấp CNI nằm ngoài phạm vi thử nghiệm e2e hiện tại của chúng tôi. Nếu bạn tìm thấy sự cố liên quan đến plugin CNI, bạn nên ghi một phiếu vào trình theo dõi sự cố tương ứng thay vì trình theo dõi sự cố kubeadm hoặc kubernetes

Một số dự án bên ngoài cung cấp mạng Kubernetes Pod bằng CNI, một số dự án cũng hỗ trợ Chính sách mạng

Xem danh sách các tiện ích bổ sung triển khai mô hình mạng Kubernetes

Bạn có thể cài đặt tiện ích bổ sung mạng Pod bằng lệnh sau trên nút mặt phẳng điều khiển hoặc nút có thông tin xác thực kubeconfig

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
0

Bạn chỉ có thể cài đặt một mạng Pod cho mỗi cụm

Khi mạng Pod đã được cài đặt, bạn có thể xác nhận rằng nó đang hoạt động bằng cách kiểm tra xem CoreDNS Pod có phải là

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
62 trong đầu ra của
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
63 không. Và khi CoreDNS Pod được thiết lập và chạy, bạn có thể tiếp tục bằng cách tham gia các nút của mình

Nếu mạng của bạn không hoạt động hoặc CoreDNS không ở trạng thái

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
62, hãy xem hướng dẫn khắc phục sự cố cho
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
7

Nhãn nút được quản lý

Theo mặc định, kubeadm kích hoạt bộ điều khiển nhập học NodeRestriction hạn chế nhãn nào có thể được kubelets tự áp dụng khi đăng ký nút. Tài liệu về bộ điều khiển nhập học bao gồm những nhãn nào được phép sử dụng với tùy chọn kubelet

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
66. Nhãn
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
67 là nhãn bị hạn chế và kubeadm áp dụng nhãn đó theo cách thủ công bằng ứng dụng khách đặc quyền sau khi nút đã được tạo. Để làm điều đó theo cách thủ công, bạn có thể thực hiện tương tự bằng cách sử dụng
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
68 và đảm bảo rằng nó đang sử dụng một kubeconfig đặc quyền, chẳng hạn như kubeadm được quản lý bởi
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
69

Cách ly nút mặt phẳng điều khiển

Theo mặc định, cụm của bạn sẽ không lên lịch cho các Nhóm trên các nút của mặt phẳng điều khiển vì lý do bảo mật. Nếu bạn muốn có thể lên lịch cho các Pod trên các nút của mặt phẳng điều khiển, chẳng hạn như đối với cụm Kubernetes của một máy duy nhất, hãy chạy

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
4

Đầu ra sẽ trông giống như

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
2

Thao tác này sẽ xóa dấu vết

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
60 khỏi bất kỳ nút nào có dấu vết đó, bao gồm cả các nút của mặt phẳng điều khiển, nghĩa là bộ lập lịch sau đó sẽ có thể lên lịch cho Pod ở mọi nơi

Tham gia các nút của bạn

Các nút là nơi khối lượng công việc của bạn (bộ chứa và Nhóm, v.v.) chạy. Để thêm các nút mới vào cụm của bạn, hãy làm như sau cho từng máy

  • SSH vào máy

  • Trở thành gốc (e. g.

    mkdir -p $HOME/.kube
    sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    61)

  • Cài đặt thời gian chạy nếu cần

  • Chạy lệnh được xuất bởi

    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    0. Ví dụ

    Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    6

Nếu bạn không có mã thông báo, bạn có thể lấy nó bằng cách chạy lệnh sau trên nút mặt phẳng điều khiển

Đầu ra tương tự như thế này

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
6

Theo mặc định, mã thông báo hết hạn sau 24 giờ. Nếu bạn đang tham gia một nút vào cụm sau khi mã thông báo hiện tại đã hết hạn, bạn có thể tạo mã thông báo mới bằng cách chạy lệnh sau trên nút mặt phẳng điều khiển

Đầu ra tương tự như thế này

Nếu bạn không có giá trị của

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
63, bạn có thể lấy nó bằng cách chạy chuỗi lệnh sau trên nút mặt phẳng điều khiển

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
2

Đầu ra tương tự như

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
0

Ghi chú. Để chỉ định một bộ IPv6 cho

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
64, địa chỉ IPv6 phải được đặt trong dấu ngoặc vuông, ví dụ:.
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
65

Đầu ra sẽ trông giống như

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
1

Một vài giây sau, bạn sẽ nhận thấy nút này trong đầu ra từ

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
66 khi chạy trên nút mặt phẳng điều khiển

Ghi chú. Vì các nút cụm thường được khởi tạo tuần tự, nên các CoreDNS Pods có khả năng chạy trên nút mặt phẳng điều khiển đầu tiên. Để cung cấp tính khả dụng cao hơn, vui lòng cân bằng lại CoreDNS Pods với

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
67 sau khi ít nhất một nút mới được tham gia

(Tùy chọn) Điều khiển cụm của bạn từ các máy không phải nút mặt phẳng điều khiển

Để có được một kubectl trên một số máy tính khác (e. g. laptop) để nói chuyện với cụm của bạn, bạn cần sao chép tệp kubeconfig của quản trị viên từ nút mặt phẳng điều khiển sang máy trạm của mình như thế này

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
2

Ghi chú

Ví dụ trên giả sử quyền truy cập SSH được bật cho root. Nếu không phải như vậy, bạn có thể sao chép tệp

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
21 để một số người dùng khác có thể truy cập được và thay vào đó,
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
69 sử dụng người dùng khác đó

Tệp

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
21 cung cấp cho người dùng các đặc quyền siêu người dùng đối với cụm. Tập tin này nên được sử dụng một cách tiết kiệm. Đối với người dùng bình thường, bạn nên tạo một thông tin xác thực duy nhất mà bạn cấp đặc quyền. Bạn có thể làm điều này bằng lệnh
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
21. Lệnh đó sẽ in ra một tệp KubeConfig thành STDOUT mà bạn nên lưu vào một tệp và phân phối cho người dùng của mình. Sau đó, cấp đặc quyền bằng cách sử dụng
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
22

(Tùy chọn) Máy chủ API ủy quyền cho máy chủ cục bộ

Nếu bạn muốn kết nối với Máy chủ API từ bên ngoài cụm, bạn có thể sử dụng

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
23

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
3

Bây giờ bạn có thể truy cập Máy chủ API cục bộ tại

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
24

Dọn dẹp

Nếu bạn đã sử dụng các máy chủ dùng một lần cho cụm của mình, để thử nghiệm, bạn có thể tắt các máy chủ đó và không cần dọn dẹp thêm. Bạn có thể sử dụng

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
25 để xóa các tham chiếu cục bộ của mình tới cụm

Tuy nhiên, nếu bạn muốn hủy cấp phép cụm của mình sạch sẽ hơn, trước tiên, bạn nên thoát nút và đảm bảo rằng nút đó trống, sau đó giải cấu hình nút

Loại bỏ nút

Nói chuyện với nút mặt phẳng điều khiển với thông tin xác thực phù hợp, hãy chạy

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
4

Trước khi xóa nút, hãy đặt lại trạng thái đã cài đặt bởi

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
7

Quá trình đặt lại không đặt lại hoặc xóa các quy tắc iptables hoặc bảng IPVS. Nếu bạn muốn đặt lại iptables, bạn phải thực hiện thủ công

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
5

Nếu bạn muốn đặt lại các bảng IPVS, bạn phải chạy lệnh sau

Bây giờ loại bỏ nút

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
6

Nếu bạn muốn bắt đầu lại, hãy chạy

export KUBECONFIG=/etc/kubernetes/admin.conf
0 hoặc
export KUBECONFIG=/etc/kubernetes/admin.conf
1 với các đối số phù hợp

Dọn dẹp máy bay điều khiển

Bạn có thể sử dụng

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
29 trên máy chủ của mặt phẳng điều khiển để kích hoạt quá trình dọn dẹp với nỗ lực cao nhất

Xem tài liệu tham khảo

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
29 để biết thêm thông tin về tiểu ban này và các tùy chọn của nó

Cái gì tiếp theo

Nhận xét

Chính sách lệch phiên bản

Mặc dù kubeadm cho phép phiên bản lệch với một số thành phần mà nó quản lý, nhưng bạn nên khớp phiên bản kubeadm với phiên bản của các thành phần mặt phẳng điều khiển, kube-proxy và kubelet

kubeadm nghiêng so với phiên bản Kubernetes

kubeadm có thể được sử dụng với các thành phần Kubernetes có cùng phiên bản với kubeadm hoặc một phiên bản cũ hơn. Phiên bản Kubernetes có thể được chỉ định cho kubeadm bằng cách sử dụng cờ

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
01 của
export KUBECONFIG=/etc/kubernetes/admin.conf
0 hoặc trường
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
03 khi sử dụng
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
04. Tùy chọn này sẽ kiểm soát các phiên bản của kube-apiserver, kube-controller-manager, kube-scheduler và kube-proxy

Thí dụ

  • kubeadm là 1. 26
  • Your Kubernetes control-plane has initialized successfully!
    
    To start using your cluster, you need to run the following as a regular user:
    
      mkdir -p $HOME/.kube
      sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
    You should now deploy a Pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      /docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
    
    05 phải ở 1. 26 hoặc 1. 25

kubeadm nghiêng so với kubelet

Tương tự như phiên bản Kubernetes, kubeadm có thể được sử dụng với phiên bản kubelet cùng phiên bản với kubeadm hoặc một phiên bản cũ hơn

Thí dụ

  • kubeadm là 1. 26
  • kubelet trên máy chủ phải ở mức 1. 26 hoặc 1. 25

kubeadm nghiêng so với kubeadm

Có một số hạn chế nhất định về cách các lệnh kubeadm có thể hoạt động trên các nút hiện có hoặc toàn bộ cụm do kubeadm quản lý

Nếu các nút mới được tham gia vào cụm, tệp nhị phân kubeadm được sử dụng cho

export KUBECONFIG=/etc/kubernetes/admin.conf
1 phải khớp với phiên bản cuối cùng của kubeadm được sử dụng để tạo cụm với
export KUBECONFIG=/etc/kubernetes/admin.conf
0 hoặc để nâng cấp cùng một nút với
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
08. Các quy tắc tương tự áp dụng cho phần còn lại của các lệnh kubeadm ngoại trừ
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
08

Ví dụ cho

export KUBECONFIG=/etc/kubernetes/admin.conf
1

  • kubeadm phiên bản 1. 26 đã được sử dụng để tạo một cụm với
    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    0
  • Các nút tham gia phải sử dụng tệp nhị phân kubeadm ở phiên bản 1. 26

Các nút đang được nâng cấp phải sử dụng phiên bản kubeadm giống với phiên bản MINOR hoặc một phiên bản MINOR mới hơn phiên bản kubeadm được sử dụng để quản lý nút

Ví dụ cho

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  /docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join : --token  --discovery-token-ca-cert-hash sha256:
08

  • kubeadm phiên bản 1. 25 đã được sử dụng để tạo hoặc nâng cấp nút
  • Phiên bản kubeadm dùng để nâng cấp nút phải ở mức 1. 25 hoặc 1. 26

Để tìm hiểu thêm về phiên bản lệch giữa các thành phần Kubernetes khác nhau, hãy xem Chính sách lệch phiên bản

Hạn chế

khả năng phục hồi cụm

Cụm được tạo ở đây có một nút mặt phẳng điều khiển duy nhất, với một cơ sở dữ liệu etcd duy nhất chạy trên đó. Điều này có nghĩa là nếu nút mặt phẳng điều khiển bị lỗi, cụm của bạn có thể bị mất dữ liệu và có thể phải tạo lại từ đầu

cách giải quyết

Khả năng tương thích nền tảng

các gói và tệp nhị phân kubeadm deb/rpm được xây dựng cho amd64, arm (32-bit), arm64, ppc64le và s390x theo đề xuất đa nền tảng

Hình ảnh vùng chứa đa nền tảng cho mặt phẳng điều khiển và addon cũng được hỗ trợ kể từ v1. 12

Chỉ một số nhà cung cấp mạng cung cấp giải pháp cho tất cả các nền tảng. Vui lòng tham khảo danh sách các nhà cung cấp mạng ở trên hoặc tài liệu của từng nhà cung cấp để biết liệu nhà cung cấp có hỗ trợ nền tảng bạn đã chọn hay không