Skip to content

Instantly share code, notes, and snippets.

@jasonbrooks
Last active October 24, 2018 21:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonbrooks/941799ec6d7b1094425525955b1e2497 to your computer and use it in GitHub Desktop.
Save jasonbrooks/941799ec6d7b1094425525955b1e2497 to your computer and use it in GitHub Desktop.

Start with CentOS 7

Set up the virt-sig repo:

# cat <<EOF > /etc/yum.repos.d/virt7-container-common-candidate.repo
[virt7-container-common-candidate]
name=virt7-container-common-candidate
baseurl=http://cbs.centos.org/repos/virt7-container-common-candidate/x86_64/os/
enabled=1
gpgcheck=0
EOF

Install cri-o and kubeadm:

# yum install -y crio kubernetes-kubeadm
# systemctl disable --now firewalld
# swapoff -a
# setenforce 0
# cat <<EOF >  /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

Edit /etc/systemd/system/kubelet.service.d/kubeadm.conf :

Environment="KUBELET_EXTRA_ARGS=--cgroup-driver=systemd --container-runtime=remote --runtime-request-timeout=15m --image-service-endpoint /var/run/crio.sock --container-runtime-endpoint /var/run/crio.sock"

Init kubeadm:

# systemctl enable --now crio
# systemctl daemon-reload
# systemctl enable --now kubelet
# kubeadm init --pod-network-cidr=10.244.0.0/16 --skip-preflight-checks
# mkdir -p $HOME/.kube
# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# sudo chown $(id -u):$(id -g) $HOME/.kube/config
# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml 
# kubectl get pods -n kube-system -w

NAME                                        READY     STATUS    RESTARTS   AGE
etcd-centos-1.osas.lab                      1/1       Running   0          51s
kube-apiserver-centos-1.osas.lab            1/1       Running   0          31s
kube-controller-manager-centos-1.osas.lab   1/1       Running   0          51s
kube-dns-545bc4bfd4-llk2j                   2/3       Running   0          35s
kube-flannel-ds-blnjq                       1/1       Running   0          26s
kube-proxy-2qcv8                            0/1       Error     2          36s

Edit /etc/crio/crio.conf, remove "/usr/share/rhel/secrets:/run/secrets", and systemctl restart crio && systemctl restart kubelet:

# kubectl get pods -n kube-system 
NAME                                        READY     STATUS    RESTARTS   AGE
etcd-centos-1.osas.lab                      1/1       Running   0          4m
kube-apiserver-centos-1.osas.lab            1/1       Running   0          4m
kube-controller-manager-centos-1.osas.lab   1/1       Running   0          4m
kube-dns-545bc4bfd4-llk2j                   3/3       Running   4          4m
kube-flannel-ds-blnjq                       1/1       Running   4          3m
kube-proxy-2qcv8                            1/1       Running   6          4m
kube-scheduler-centos-1.osas.lab            1/1       Running   0          3m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment