Compare commits
15 Commits
release/1.
...
Guide
| Author | SHA1 | Date |
|---|---|---|
|
|
89a33029f0 | |
|
|
7df0c3d927 | |
|
|
36cfad6a3d | |
|
|
995fc581d8 | |
|
|
5d0bbc4c9e | |
|
|
70c129b82c | |
|
|
2146fc0369 | |
|
|
9c105a76aa | |
|
|
574aea36e3 | |
|
|
405e316e89 | |
|
|
ecbd1967f8 | |
|
|
634a3a9506 | |
|
|
3963e1c763 | |
|
|
32f30dbe09 | |
|
|
6f36a4a39a |
93
ReadME.MD
93
ReadME.MD
|
|
@ -1,33 +1,64 @@
|
|||
# Kubernetes 1.27
|
||||
|
||||
## Important Change
|
||||
|
||||
### Support for Juju 3.1
|
||||
|
||||
With this release, Charmed Kubernetes can be deployed with a juju 2.9, 3.0 or 3.1 controller. This release is intended to serve as a migration point away from juju 2.9 deployments which is why we offer a tested strategy of our charms on both 2.9 and 3.1 releases.
|
||||
|
||||
### Cilium CNI
|
||||
|
||||
We are excited to announce the inclusion of Cilium in our portfolio of Container Network Interface solutions for Charmed Kubernetes. Cilium is a powerful CNI, network security and observability solution which provides enhanced performance and improved security for containerised applications. The current version of Cilium shipped within the charm is 1.12.5. It also comes bundled with Hubble: a networking and security observability solution that offers real time insights of the network and the security state of the cluster with little performance impact.
|
||||
|
||||
### Cloud Providers and Cloud Storage
|
||||
|
||||
Operator charms for external cloud providers have been expanded and now include AWS, Azure, GCP, and vSphere. Previously, cloud-specific features such as load balancing and storage were managed by Kubernetes in-tree solutions. Today, cloud provider charms offer flexible management of these features decoupled from any specific Kubernetes release.
|
||||
|
||||
### NVIDIA Network Operator
|
||||
|
||||
The NVIDIA network operator charm is a new addition to the Charmed Kubernetes ecosystem. It simplifies the deployment, operation, and management of NVIDIA networking resources for Kubernetes.
|
||||
## 安装 Charm 2.x
|
||||
|
||||
```Bash
|
||||
juju download ch:etcd --channel 1.27/stable --series focal
|
||||
juju download ch:easyrsa --channel 1.27/stable --series focal
|
||||
juju download ch:kubernetes-control-plane --channel 1.27/stable --series focal
|
||||
juju download ch:kubernetes-worker --channel 1.27/stable --series focal
|
||||
juju download ch:calico --channel 1.27/stable --series focal
|
||||
juju download ch:containerd --channel 1.27/stable --series focal
|
||||
juju download ch:kata --channel 1.27/stable --series focal
|
||||
# Extend
|
||||
juju download ch:kubeapi-load-balancer --channel 1.27/stable --series focal
|
||||
juju download ch:keepalived --channel 1.27/stable --series focal
|
||||
juju download ch:coredns --channel 1.27/stable --series focal
|
||||
```
|
||||
# 如果是使用 1.24 版本以及以后, 此步骤可以跳过
|
||||
snap install charm --channel=2.x --classic
|
||||
```
|
||||
|
||||
## 获取特定版本的 Bundle
|
||||
|
||||
```Bash
|
||||
wget https://raw.githubusercontent.com/charmed-kubernetes/bundle/main/releases/1.21/bundle.yaml
|
||||
```
|
||||
|
||||
或是
|
||||
|
||||
```Bash
|
||||
# 对于 1.23 版本以及以前
|
||||
charm pull cs:~containers/charmed-kubernetes-657
|
||||
|
||||
# 对于 1.24 版本以及以后
|
||||
juju download ch:charmed-kubernetes --channel 1.24/stable --series focal
|
||||
```
|
||||
|
||||
## 拉取 Bundle 中的相关组件
|
||||
|
||||
```Bash
|
||||
# 对于 1.23 版本以及以前
|
||||
charm pull cs:~containers/etcd-607
|
||||
|
||||
# 对于 1.24 版本以及以后
|
||||
juju download ch:etcd --channel 1.24/stable --series focal
|
||||
```
|
||||
|
||||
## 拉取相关组件的资源包
|
||||
|
||||
```Bash
|
||||
# 对于 1.23 版本以及以前
|
||||
charm list-resources cs:~containers/calico-812
|
||||
wget https://api.jujucharms.com/charmstore/v5/~containers/calico-812/resource/calico/1027 -O calico.tgz
|
||||
wget https://api.jujucharms.com/charmstore/v5/~containers/calico-812/resource/calico-arm64/1026 -O calico-arm64.tgz
|
||||
wget https://api.jujucharms.com/charmstore/v5/~containers/calico-812/resource/calico-node-image/709 -O calico-node-image.tgz
|
||||
wget https://api.jujucharms.com/charmstore/v5/~containers/calico-812/resource/calico-upgrade/854 -O calico-upgrade.tgz
|
||||
wget https://api.jujucharms.com/charmstore/v5/~containers/calico-812/resource/calico-upgrade-arm64/854 -O calico-upgrade-arm64.tgz
|
||||
|
||||
# 对于 1.24 版本以及以后
|
||||
unzip xxx.charm
|
||||
build-xxx-resource.sh
|
||||
# 或
|
||||
前往 https://charmhub.io/calico/resources/calico?channel=1.24/stable 下载对应的 Revision
|
||||
```
|
||||
|
||||
## 向 Controller 上传资源
|
||||
|
||||
```Bash
|
||||
# ex: juju attach-resource <charm-name> resource-name=<filepath>
|
||||
juju attach-resource calico calico=/home/sa/charm/calico/calico-amd64.tar.gz
|
||||
juju attach-resource calico calico-upgrade=/home/sa/charm/calico/calico-upgrade-amd64.tar.gz
|
||||
```
|
||||
|
||||
## 回收节点
|
||||
|
||||
```None
|
||||
https://git.motofans.club/Motofans/Charmed-Kubernetes/src/branch/Guide/cleanup-k8s-node.py
|
||||
```
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import subprocess
|
||||
|
||||
# Purge snap packages
|
||||
snap_packages = [
|
||||
"cdk-addons",
|
||||
"kube-apiserver",
|
||||
"kube-controller-manager",
|
||||
"kube-proxy",
|
||||
"kube-scheduler",
|
||||
"kubelet",
|
||||
"kubectl",
|
||||
"etcd"
|
||||
]
|
||||
|
||||
for package in snap_packages:
|
||||
subprocess.run(["snap", "remove", package, "--purge"])
|
||||
|
||||
# Purge Debian packages
|
||||
packages_to_purge = [
|
||||
"nginx-full",
|
||||
"containerd",
|
||||
"keepalived"
|
||||
]
|
||||
|
||||
subprocess.run(["apt", "purge", "-y"] + packages_to_purge + ["--allow-change-held-packages"])
|
||||
subprocess.run(["apt", "autoremove", "-y", "--purge"])
|
||||
subprocess.run(["/sbin/remove-juju-services"])
|
||||
|
||||
# Remove directories and files
|
||||
directories = [
|
||||
"/var/log/juju",
|
||||
"/var/lib/juju",
|
||||
"/home/ubuntu/config*",
|
||||
"/root/cdk",
|
||||
"/etc/juju-proxy*",
|
||||
"/var/run/calico",
|
||||
"/var/lib/calico",
|
||||
"/var/log/calico",
|
||||
"/etc/containerd",
|
||||
"/var/lib/containerd",
|
||||
"/opt/calicoctl",
|
||||
"/opt/cni",
|
||||
"/opt/containerd",
|
||||
"/etc/keepalived"
|
||||
]
|
||||
|
||||
for directory in directories:
|
||||
subprocess.run(["rm", "-rf", directory])
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
|
||||
command -v jq >/dev/null 2>&1 || { echo "jq is required but not installed. Exiting."; exit 1; }
|
||||
command -v snap >/dev/null 2>&1 || { echo "snap is required but not installed. Exiting."; exit 1; }
|
||||
|
||||
# Constants
|
||||
ALL_SNAPS="kube-apiserver kube-scheduler kube-controller-manager kube-proxy kubectl kubelet cdk-addons"
|
||||
MASTER_SNAPS="kube-apiserver kube-scheduler kube-controller-manager kube-proxy kubectl cdk-addons"
|
||||
WORKER_SNAPS="kube-proxy kubelet kubectl"
|
||||
|
||||
# Prompt for channels
|
||||
read -p "Enter the SNAP_CHANNEL (e.g. 1.21/stable): " SNAP_CHANNEL
|
||||
read -p "Enter the JUJU_CHANNEL (e.g. 2.9/stable): " JUJU_CHANNEL
|
||||
|
||||
# Function to download snaps from a specific channel
|
||||
download_snaps() {
|
||||
local snaps=$1
|
||||
local channel=$2
|
||||
for snap in $snaps; do
|
||||
echo "Downloading $snap from channel $channel..."
|
||||
snap download --channel="$channel" "$snap" || exit 1
|
||||
done
|
||||
}
|
||||
|
||||
# Function to attach snaps to units
|
||||
attach_snaps_to_units() {
|
||||
local snaps=$1
|
||||
local service=$2
|
||||
for snap in $snaps; do
|
||||
local snap_file
|
||||
snap_file=$(ls "${snap}"_*.snap | head -n 1)
|
||||
if [[ -f "$snap_file" ]]; then
|
||||
echo "Attaching $snap_file to $service..."
|
||||
juju attach "$service" "$snap"="$snap_file" || exit 1
|
||||
else
|
||||
echo "Error: $snap_file not found."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Function to upgrade units of a service
|
||||
upgrade_service_units() {
|
||||
local service=$1
|
||||
local unit_names
|
||||
unit_names=$(juju status --format json | jq -r ".applications|.[\"$service\"].units | keys[]")
|
||||
for unit in $unit_names; do
|
||||
echo "Upgrading $unit..."
|
||||
juju run-action "$unit" upgrade --wait || exit 1
|
||||
done
|
||||
}
|
||||
|
||||
# Download Juju
|
||||
echo "Downloading Juju from channel $JUJU_CHANNEL..."
|
||||
snap download --channel="$JUJU_CHANNEL" juju || exit 1
|
||||
|
||||
# Download Kubernetes snaps
|
||||
download_snaps "$ALL_SNAPS" "$SNAP_CHANNEL"
|
||||
|
||||
# Attach new snaps to Kubernetes master and worker units
|
||||
attach_snaps_to_units "$MASTER_SNAPS" "kubernetes-master"
|
||||
attach_snaps_to_units "$WORKER_SNAPS" "kubernetes-worker"
|
||||
|
||||
# Upgrade Kubernetes master and worker units
|
||||
upgrade_service_units "kubernetes-master"
|
||||
upgrade_service_units "kubernetes-worker"
|
||||
|
||||
echo "Upgrade process completed successfully."
|
||||
Loading…
Reference in New Issue