![設定 ip kubespray: "msg": "IPv4: '['.....']' 和 IPv6: '['f....']' 不包含 '....'"](https://rvso.com/image/789360/%E8%A8%AD%E5%AE%9A%20ip%20kubespray%3A%20%22msg%22%3A%20%22IPv4%3A%20'%5B'.....'%5D'%20%E5%92%8C%20IPv6%3A%20'%5B'f....'%5D'%20%E4%B8%8D%E5%8C%85%E5%90%AB%20'....'%22.png)
我想使用 Kubespray 在 Oracle Cloud VM 上安裝 Kubernetes。我嘗試了以下步驟:
apt install python3-pip
git clone https://github.com/kubernetes-sigs/kubespray
cd kubespray
git checkout master #if you want to change version
sudo pip3 install -r requirements.txt
cp -rfp inventory/sample inventory/mycluster
declare -a IPS=(192.168.1.24 192.168.1.25 192.168.1.26)
CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
vi inventory/mycluster/hosts.yaml
ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml
在 Oracle 雲端中,每個 VM 都有一個私人 IP,例如 10.0.0.x 和公用 IP 141.147.3.x。我在 Kubespray 執行期間收到此錯誤:
fatal: [node1]: FAILED! => {
"assertion": "(ip in ansible_all_ipv4_addresses) or (ip in ansible_all_ipv6_addresses)",
"changed": false,
"evaluated_to": false,
"msg": "IPv4: '['10.0.0.x']' and IPv6: '['........']' do not contain '141.147.3.x'"
}
在叢集檔案中我有這樣的設定:
all:
hosts:
node1:
ansible_host: 192.168.1.24
ip: 192.168.1.24
access_ip: 192.168.1.24
node2:
ansible_host: 192.168.1.25
ip: 192.168.1.25
access_ip: 192.168.1.25
node3:
ansible_host: 192.168.1.26
ip: 192.168.1.26
access_ip: 192.168.1.26
children:
kube_control_plane:
hosts:
node1:
kube_node:
hosts:
node2:
node3:
etcd:
hosts:
node1:
node2:
node3:
k8s_cluster:
children:
kube_control_plane:
kube_node:
calico_rr:
hosts: {}
- 這些只是範例 IP
你知道我該如何解決這個問題嗎?