From Fedora Project Wiki

< User:Jasonbrooks

Revision as of 00:42, 29 September 2017 by Jasonbrooks (talk | contribs) (Created page with "{{QA/Test_Case |description=Install Kubernetes on Fedora Atomic Host using [ kubeadm]. |setup= * Install one or more Fedora Atomic Hos...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Install Kubernetes on Fedora Atomic Host using kubeadm.


  • Install one or more Fedora Atomic Hosts.

How to test

  • Use package layering to install kubeadm on each host:
 rpm-ostree install kubernetes-kubeadm ethtool ebtables -r
  • Unfortunately, as of 1.7.3, SELinux again needs to be in permissive mode for kubeadm to work:
# setenforce 0

  • Start the kubelet and initialize the kubernetes cluster. We specify a pod-network-cidr because flannel, which we'll use in this test, requires it, and we skip preflight checks because FAH27 includes docker 1.13, which kubernetes does not yet explicitly support, and because kubeadm looks in the wrong place for kernel config.
# systemctl enable --now kubelet

# kubeadm init --pod-network-cidr= --skip-preflight-checks

  • Follow the directions in the resulting output to configure kubectl:
# mkdir -p $HOME/.kube
# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# sudo chown $(id -u):$(id -g) $HOME/.kube/config

  • Deploy the flannel network plugin:
# kubectl apply -f
  • By default, your cluster will not schedule pods on the master for security reasons. If you want to be able to schedule pods on the master, e.g. for a single-machine Kubernetes cluster run:
# kubectl taint nodes --all
  • If desired, join additional nodes to the master using the kubeadm join command provided in the kubeadm init output. For instance:
# kubeadm join --token 2a247c.f357bc09c56b12c8 atomic1:6443
  • Check on the install:
# kubectl get nodes
NAME                                           STATUS    AGE       VERSION
atomic1   Ready     6m        v1.7.3

# kubectl get pods --all-namespaces
NAMESPACE     NAME                              READY     STATUS    RESTARTS   AGE
kube-system   etcd-atomic1                      1/1       Running   0          5m
kube-system   kube-apiserver-atomic1            1/1       Running   0          6m
kube-system   kube-controller-manager-atomic1   1/1       Running   0          5m
kube-system   kube-dns-2425271678-lpqlt         3/3       Running   0          6m
kube-system   kube-flannel-ds-fcmbb             1/1       Running   0          4m
kube-system   kube-proxy-mrdf4                  1/1       Running   0          6m
kube-system   kube-scheduler-atomic1            1/1       Running   0          6m

  • Run some test apps
# kubectl run nginx --image=nginx --port=80 --replicas=3
deployment "nginx" created

# kubectl get pods -o wide
NAME                    READY     STATUS    RESTARTS   AGE       IP            NODE
nginx-158599303-dbkjw   1/1       Running   0          19s    atomic1
nginx-158599303-g4q7c   1/1       Running   0          19s    atomic1
nginx-158599303-n0mwm   1/1       Running   0          19s    atomic1

# kubectl expose deployment nginx --type NodePort
service "nginx" exposed

# kubectl get svc
kubernetes      <none>        443/TCP        40m
nginx   <nodes>       80:32681/TCP   14s

# curl http://atomic1:32681
<!DOCTYPE html>
<title>Welcome to nginx!</title>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href=""></a>.<br/>
Commercial support is available at
<a href=""></a>.</p>

<p><em>Thank you for using nginx.</em></p>

Expected Results

  1. kubeadm runs without error.
  2. You're able to run Kubernetes apps using the cluster.