更换 软件源

翻墙

基本配置

  1. 内存交换
  2. 防火墙
  3. selinux

安装 docker

配置 kubernetes 源 + 安装工具 kubelet kubeadm kubectl

sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

没有梯子的启动方法

有梯子

FAQ

  1. apt-get update locked

     root@ubuntu:/etc/apt# apt-get update
     正在读取软件包列表。.. 完成
     E: 无法获得锁 /var/lib/apt/lists/lock - open (11: 资源暂时不可用)
     E: 无法对目录 /var/lib/apt/lists/ 加锁
    

    其他程序在占用 apt-get 程序,kill 或等待结束

  2. 权限问题

     ares@ubuntu:~/go/src/alex/content$ touch t.md
     touch: 无法创建't.md': 权限不够
    
     Unable to write file (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/home/ares/go/src/alex/content/ubuntu.md')
    
     goland 创建文件失败:
     Cannot modify a read-only directory
    

    更改当前用户目录下所有文件的所有者:chown ares ares/ -R

  3. 总是锁屏

    1. 设置——隐私——锁屏
  4. 使用代理

    1. https://tomoyadeng.github.io/blog/2018/10/12/k8s-in-ubuntu18.04/index.html
  5. apt-get 公钥

    错误:9 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
    由于没有公钥,无法验证下列签名: NO_PUBKEY 6A030B21BA07F4FB
    正在读取软件包列表。.. 完成
    W: GPG 错误:https://packages.cloud.google.com/apt kubernetes-xenial InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY 6A030B21BA07F4FB
    E: 仓库 “http://apt.kubernetes.io kubernetes-xenial InRelease” 没有数字签名。
    N: 无法安全地用该源进行更新,所以默认禁用该源。
    N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
    

    那就生成公钥: apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 6A030B21BA07F4FB (公钥)

    • 注意得是自己 bao’duo
  6. docker 版本问题

    [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.4. Latest validated version: 18.09
    

    卸不掉:直接安装降级 apt-get -y install docker-ce=18.06.1~ce~3-0~ubuntu –allow-downgrades

  7. 代理已配 浏览器+命令行,但是还是无法拉取镜像

    failed to pull image "k8s.gcr.io/kube-apiserver:v1.16.2": output: Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
    , error: exit status 1
    
  8. Error response from daemon: Get https://k8s.gcr.io/v2/: proxyconnect tcp: net/http: TLS handshake timeout

  9. Error response from daemon: Get https://registry.cn-hangzhou.aliyuncs.com/v2/: proxyconnect tcp: net/http: TLS handshake timeout

  10. E212: 无法打开并写入文件 权限问题,更改用户

  11. [WARNING Service-Docker]: docker service is not enabled, please run ‘systemctl enable docker.service’ systemctl enable docker.service

  12. Failed to enable unit: Unit file /lib/systemd/system/docker.service is masked. systemctl unmask docker.service systemctl unmask docker.socket systemctl start docker.service

    mask是的更强版本disable。使用disable指定单位文件的所有符号链接都将被删除。如果使用mask单位将链接到/dev/null。如果您通过进行检查,将显示此信息systemctl status halt.service。的优点mask是可以防止任何形式的激活,甚至是手动激活。

    注意:systemctl list-unit-files列出了单元文件的状态(静态,启用,禁用,屏蔽,间接),与服务状态无关。看一下服务使用情况systemctl list-units

    reboot 无效,重装吧

  13. [WARNING IsDockerSystemdCheck]: detected “cgroupfs” as the Docker cgroup driver. The recommended driver is “systemd”. Please follow the guide at https://kubernetes.io/docs/setup/cri/ 配置:/etc/docker/daemon.json “exec-opts”: [“native.cgroupdriver=systemd”]

  14. [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.4. Latest validated version: 18.09

    更换docker版本

  15. [WARNING HTTPProxy]: Connection to “https://1.2.3.4” uses proxy “http://192.168.136.1:1080/”. If that is not intended, adjust your proxy settings [WARNING HTTPProxyCIDR]: connection to “10.96.0.0/12” uses proxy “http://192.168.136.1:1080/”. This may lead to malfunctional cluster setup. Make sure that Pod and Services IP ranges specified correctly as exceptions in proxy configuration

  16. kubelet.go:2267] node “ubuntu” not found https://github.com/kubernetes/kubernetes/issues/74262 我在Ubuntu 18.04和Kube 1.14.0中遇到了相同的问题。将advertised-address设置为0.0.0.0而不是指定我的机器的IP地址即可解决此问题。非常感谢您的评论。