1. 程式人生 > 實用技巧 >自學k8s-安裝過程為下載flannel.yml和映象檔案,而需要設定的代理

自學k8s-安裝過程為下載flannel.yml和映象檔案,而需要設定的代理

1、yum代理設定
編輯檔案為:/etc/yum.conf
在裡面新增這一行:proxy=IP:PORT
這裡的IP 為你要設定的IP ,PORT 是你要設定的埠

2、wget的代理設定

用vi/vim編輯器開啟/etc/wgetrc,找到代理設定所在行,然後追加如下內容:
# You can set the default proxies for Wget to use for http, https, and ftp.
# They will override the value in the environment.
#https_proxy = http://proxy.yoyodyne.com:18023/
#http_proxy = http://proxy.yoyodyne.com:18023/
#ftp_proxy = http://proxy.yoyodyne.com:18023/
新增下面兩行:
http_proxy = IP:PORT
ftp_proxy = IP:PORT

[root@k8s-master ~]# vim /etc/wgetrc 
[root@k8s-master ~]# wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
--2020-11-14 02:27:37--  https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Connecting to 139.224.67.47:8789... connected.
Proxy request sent, awaiting response... 200 OK
Length: 4813 (4.7K) [text/plain]
Saving to: ‘kube-flannel.yml’

100%[==============================================================================================>] 4,813       --.-K/s   in 0s      

2020-11-14 02:27:37 (37.7 MB/s) - ‘kube-flannel.yml’ saved [4813/4813]

[root@k8s-master ~]# ls
anaconda-ks.cfg  kube-flannel.yml  original-ks.cfg
[root@k8s-master ~]# vim /etc/yum.conf 
[root@k8s-master ~]#