云原生之初探 Seal OS

    安装

    1. 安装 SelaOS

    参考官方文档 https://sealos.io/zh-Hans/docs/lifecycle-management/quick-start/installation

    2. 初始化 Kubernetes

    参考官方文档 https://sealos.io/zh-Hans/docs/lifecycle-management/quick-start/

    sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 --single

    部署 SealOS

    ...

    https://mp.weixin.qq.com/s/tlXQ92jM2T35z-57oPsaRQ

    附录

    安装日志如下

    root@sealos:~# export
    declare -x DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/0/bus"
    declare -x DEBUGINFOD_URLS=""
    declare -x HOME="/root"
    declare -x LANG="en_US.UTF-8"
    declare -x LESSCLOSE="/usr/bin/lesspipe %s %s"
    declare -x LESSOPEN="| /usr/bin/lesspipe %s"
    declare -x LOGNAME="root"
    declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"
    declare -x MOTD_SHOWN="pam"
    declare -x OLDPWD
    declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
    declare -x PWD="/root"
    declare -x SHELL="/bin/bash"
    declare -x SHLVL="1"
    declare -x SSH_CLIENT="192.168.4.3 65055 22"
    declare -x SSH_CONNECTION="192.168.4.3 65055 192.168.4.15 22"
    declare -x SSH_TTY="/dev/pts/3"
    declare -x TERM="xterm-256color"
    declare -x USER="root"
    declare -x XDG_DATA_DIRS="/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop"
    declare -x XDG_RUNTIME_DIR="/run/user/0"
    declare -x XDG_SESSION_CLASS="user"
    declare -x XDG_SESSION_ID="17"
    declare -x XDG_SESSION_TYPE="tty"
    root@sealos:~# sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 --single
    Flag --single has been deprecated, it defaults to running cluster in single mode when there are no master and node
    2023-09-06T22:20:21 info Start to create a new cluster: master [192.168.4.15], worker [], registry 192.168.4.15
    2023-09-06T22:20:21 info Executing pipeline Check in CreateProcessor.
    2023-09-06T22:20:21 info checker:hostname [192.168.4.15:22]
    2023-09-06T22:20:21 info checker:timeSync [192.168.4.15:22]
    2023-09-06T22:20:21 info Executing pipeline PreProcess in CreateProcessor.
    2023-09-06T22:20:21 info Executing pipeline RunConfig in CreateProcessor.
    2023-09-06T22:20:21 info Executing pipeline MountRootfs in CreateProcessor.
    2023-09-06T22:20:22 info Executing pipeline MirrorRegistry in CreateProcessor.
    2023-09-06T22:20:22 info trying default http mode to sync images to hosts [192.168.4.15:22]
    2023-09-06T22:20:26 info Executing pipeline Bootstrap in CreateProcessor
     INFO [2023-09-06 22:20:26] >> Check port kubelet port 10249..10259, reserved port 5050..5054 inuse. Please wait... 
     INFO [2023-09-06 22:20:27] >> check root,port,cri success 
    2023-09-06T22:20:27 info domain sealos.hub:192.168.4.15 append success
    Created symlink /etc/systemd/system/multi-user.target.wants/registry.service → /etc/systemd/system/registry.service.
     INFO [2023-09-06 22:20:28] >> Health check registry! 
     INFO [2023-09-06 22:20:28] >> registry is running 
     INFO [2023-09-06 22:20:28] >> init registry success 
    Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /etc/systemd/system/containerd.service.
     INFO [2023-09-06 22:20:31] >> Health check containerd! 
     INFO [2023-09-06 22:20:31] >> containerd is running 
     INFO [2023-09-06 22:20:31] >> init containerd success 
    Created symlink /etc/systemd/system/multi-user.target.wants/image-cri-shim.service → /etc/systemd/system/image-cri-shim.service.
     INFO [2023-09-06 22:20:31] >> Health check image-cri-shim! 
     INFO [2023-09-06 22:20:31] >> image-cri-shim is running 
     INFO [2023-09-06 22:20:31] >> init shim success 
    127.0.0.1 localhost
    ::1 ip6-localhost ip6-loopback
    Firewall stopped and disabled on system startup
    * Applying /etc/sysctl.d/10-console-messages.conf ...
    kernel.printk = 4 4 1 7
    * Applying /etc/sysctl.d/10-ipv6-privacy.conf ...
    net.ipv6.conf.all.use_tempaddr = 2
    net.ipv6.conf.default.use_tempaddr = 2
    * Applying /etc/sysctl.d/10-kernel-hardening.conf ...
    kernel.kptr_restrict = 1
    * Applying /etc/sysctl.d/10-magic-sysrq.conf ...
    kernel.sysrq = 176
    * Applying /etc/sysctl.d/10-network-security.conf ...
    net.ipv4.conf.default.rp_filter = 2
    net.ipv4.conf.all.rp_filter = 2
    * Applying /etc/sysctl.d/10-ptrace.conf ...
    kernel.yama.ptrace_scope = 1
    * Applying /etc/sysctl.d/10-zeropage.conf ...
    vm.mmap_min_addr = 65536
    * Applying /usr/lib/sysctl.d/30-tracker.conf ...
    fs.inotify.max_user_watches = 65536
    * Applying /usr/lib/sysctl.d/50-bubblewrap.conf ...
    kernel.unprivileged_userns_clone = 1
    * Applying /usr/lib/sysctl.d/50-default.conf ...
    kernel.core_uses_pid = 1
    net.ipv4.conf.default.rp_filter = 2
    net.ipv4.conf.default.accept_source_route = 0
    sysctl: setting key "net.ipv4.conf.all.accept_source_route": Invalid argument
    net.ipv4.conf.default.promote_secondaries = 1
    sysctl: setting key "net.ipv4.conf.all.promote_secondaries": Invalid argument
    net.ipv4.ping_group_range = 0 2147483647
    net.core.default_qdisc = fq_codel
    fs.protected_hardlinks = 1
    fs.protected_symlinks = 1
    fs.protected_regular = 1
    fs.protected_fifos = 1
    * Applying /usr/lib/sysctl.d/50-pid-max.conf ...
    kernel.pid_max = 4194304
    * Applying /usr/lib/sysctl.d/99-protect-links.conf ...
    fs.protected_fifos = 1
    fs.protected_hardlinks = 1
    fs.protected_regular = 2
    fs.protected_symlinks = 1
    * Applying /etc/sysctl.d/99-sysctl.conf ...
    fs.file-max = 1048576 # sealos
    net.bridge.bridge-nf-call-ip6tables = 1 # sealos
    net.bridge.bridge-nf-call-iptables = 1 # sealos
    net.core.somaxconn = 65535 # sealos
    net.ipv4.conf.all.rp_filter = 0 # sealos
    net.ipv4.ip_forward = 1 # sealos
    net.ipv4.ip_local_port_range = 1024 65535 # sealos
    net.ipv6.conf.all.forwarding = 1 # sealos
    * Applying /etc/sysctl.conf ...
    fs.file-max = 1048576 # sealos
    net.bridge.bridge-nf-call-ip6tables = 1 # sealos
    net.bridge.bridge-nf-call-iptables = 1 # sealos
    net.core.somaxconn = 65535 # sealos
    net.ipv4.conf.all.rp_filter = 0 # sealos
    net.ipv4.ip_forward = 1 # sealos
    net.ipv4.ip_local_port_range = 1024 65535 # sealos
    net.ipv6.conf.all.forwarding = 1 # sealos
     INFO [2023-09-06 22:20:32] >> pull pause image sealos.hub:5000/pause:3.8 
    Image is up to date for sha256:4873874c08efc72e9729683a83ffbb7502ee729e9a5ac097723806ea7fa13517
     INFO [2023-09-06 22:20:32] >> init kubelet success 
     INFO [2023-09-06 22:20:32] >> init rootfs success 
    2023-09-06T22:20:32 info Executing pipeline Init in CreateProcessor.
    2023-09-06T22:20:32 info start to copy kubeadm config to master0
    2023-09-06T22:20:33 info start to generate cert and kubeConfig...
    2023-09-06T22:20:33 info start to generator cert and copy to masters...
    2023-09-06T22:20:33 info apiserver altNames : {map[apiserver.cluster.local:apiserver.cluster.local kubernetes:kubernetes kubernetes.default:kubernetes.default kubernetes.default.svc:kubernetes.default.svc kubernetes.default.svc.cluster.local:kubernetes.default.svc.cluster.local localhost:localhost sealos:sealos] map[10.103.97.2:10.103.97.2 10.96.0.1:10.96.0.1 127.0.0.1:127.0.0.1 192.168.4.15:192.168.4.15]}
    2023-09-06T22:20:33 info Etcd altnames : {map[localhost:localhost sealos:sealos] map[127.0.0.1:127.0.0.1 192.168.4.15:192.168.4.15 ::1:::1]}, commonName : sealos
    2023-09-06T22:20:34 info start to copy etc pki files to masters
    2023-09-06T22:20:34 info start to copy etc pki files to masters
    2023-09-06T22:20:34 info start to create kubeconfig...
    2023-09-06T22:20:35 info start to copy kubeconfig files to masters
    2023-09-06T22:20:35 info start to copy static files to masters
    2023-09-06T22:20:35 info start to init master0...
    2023-09-06T22:20:35 info domain apiserver.cluster.local:192.168.4.15 append success
    W0906 22:20:35.400822   24682 initconfiguration.go:119] Usage of CRI endpoints without URL scheme is deprecated and can cause kubelet errors in the future. Automatically prepending scheme "unix" to the "criSocket" with value "/run/containerd/containerd.sock". Please update your configuration!
    W0906 22:20:35.400879   24682 utils.go:69] The recommended value for "healthzBindAddress" in "KubeletConfiguration" is: 127.0.0.1; the provided value is: 0.0.0.0
    [init] Using Kubernetes version: v1.25.0
    [preflight] Running pre-flight checks
            [WARNING FileExisting-ethtool]: ethtool not found in system path
            [WARNING FileExisting-socat]: socat not found in system path
            [WARNING SystemVerification]: missing optional cgroups: blkio
    [preflight] Pulling images required for setting up a Kubernetes cluster
    [preflight] This might take a minute or two, depending on the speed of your internet connection
    [preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
    [certs] Using certificateDir folder "/etc/kubernetes/pki"
    [certs] Using existing ca certificate authority
    [certs] Using existing apiserver certificate and key on disk
    [certs] Using existing apiserver-kubelet-client certificate and key on disk
    [certs] Using existing front-proxy-ca certificate authority
    [certs] Using existing front-proxy-client certificate and key on disk
    [certs] Using existing etcd/ca certificate authority
    [certs] Using existing etcd/server certificate and key on disk
    [certs] Using existing etcd/peer certificate and key on disk
    [certs] Using existing etcd/healthcheck-client certificate and key on disk
    [certs] Using existing apiserver-etcd-client certificate and key on disk
    [certs] Using the existing "sa" key
    [kubeconfig] Using kubeconfig folder "/etc/kubernetes"
    [kubeconfig] Using existing kubeconfig file: "/etc/kubernetes/admin.conf"
    [kubeconfig] Using existing kubeconfig file: "/etc/kubernetes/kubelet.conf"
    W0906 22:20:45.654863   24682 kubeconfig.go:249] a kubeconfig file "/etc/kubernetes/controller-manager.conf" exists already but has an unexpected API Server URL: expected: https://192.168.4.15:6443, got: https://apiserver.cluster.local:6443
    [kubeconfig] Using existing kubeconfig file: "/etc/kubernetes/controller-manager.conf"
    W0906 22:20:45.729986   24682 kubeconfig.go:249] a kubeconfig file "/etc/kubernetes/scheduler.conf" exists already but has an unexpected API Server URL: expected: https://192.168.4.15:6443, got: https://apiserver.cluster.local:6443
    [kubeconfig] Using existing kubeconfig file: "/etc/kubernetes/scheduler.conf"
    [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
    [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
    [kubelet-start] Starting the kubelet
    [control-plane] Using manifest folder "/etc/kubernetes/manifests"
    [control-plane] Creating static Pod manifest for "kube-apiserver"
    [control-plane] Creating static Pod manifest for "kube-controller-manager"
    [control-plane] Creating static Pod manifest for "kube-scheduler"
    [etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
    [wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
    [apiclient] All control plane components are healthy after 15.504823 seconds
    [upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
    [kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster
    [upload-certs] Skipping phase. Please see --upload-certs
    [mark-control-plane] Marking the node sealos as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
    [bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
    [bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes
    [bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
    [bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
    [bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
    [bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
    [kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
    [addons] Applied essential addon: CoreDNS
    [addons] Applied essential addon: kube-proxy
    
    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
    
    Alternatively, if you are the root user, you can run:
    
      export KUBECONFIG=/etc/kubernetes/admin.conf
    
    You should now deploy a pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      https://kubernetes.io/docs/concepts/cluster-administration/addons/
    
    You can now join any number of control-plane nodes by copying certificate authorities
    and service account keys on each node and then running the following as root:
    
      kubeadm join apiserver.cluster.local:6443 --token <value withheld> \
            --discovery-token-ca-cert-hash sha256:81cc3c02a29deee26a5b4613e07f7f3c594824d0b459c6efce04d1c9325d0f4d \
            --control-plane --certificate-key <value withheld>
    
    Then you can join any number of worker nodes by running the following on each as root:
    
    kubeadm join apiserver.cluster.local:6443 --token <value withheld> \
            --discovery-token-ca-cert-hash sha256:81cc3c02a29deee26a5b4613e07f7f3c594824d0b459c6efce04d1c9325d0f4d 
    2023-09-06T22:21:03 info Executing pipeline Join in CreateProcessor.
    2023-09-06T22:21:03 info Executing pipeline RunGuest in CreateProcessor.
    Release "calico" does not exist. Installing it now.
    NAME: calico
    LAST DEPLOYED: Wed Sep  6 22:21:06 2023
    NAMESPACE: tigera-operator
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    2023-09-06T22:21:10 info succeeded in creating a new cluster, enjoy it!
    2023-09-06T22:21:10 info 
          ___           ___           ___           ___       ___           ___
         /\  \         /\  \         /\  \         /\__\     /\  \         /\  \
        /::\  \       /::\  \       /::\  \       /:/  /    /::\  \       /::\  \
       /:/\ \  \     /:/\:\  \     /:/\:\  \     /:/  /    /:/\:\  \     /:/\ \  \
      _\:\~\ \  \   /::\~\:\  \   /::\~\:\  \   /:/  /    /:/  \:\  \   _\:\~\ \  \
     /\ \:\ \ \__\ /:/\:\ \:\__\ /:/\:\ \:\__\ /:/__/    /:/__/ \:\__\ /\ \:\ \ \__\
     \:\ \:\ \/__/ \:\~\:\ \/__/ \/__\:\/:/  / \:\  \    \:\  \ /:/  / \:\ \:\ \/__/
      \:\ \:\__\    \:\ \:\__\        \::/  /   \:\  \    \:\  /:/  /   \:\ \:\__\
       \:\/:/  /     \:\ \/__/        /:/  /     \:\  \    \:\/:/  /     \:\/:/  /
        \::/  /       \:\__\         /:/  /       \:\__\    \::/  /       \::/  /
         \/__/         \/__/         \/__/         \/__/     \/__/         \/__/
    
                      Website: https://www.sealos.io/
                      Address: github.com/labring/sealos
                      Version: 4.3.3-d27f4fbc
    

    评论栏