Monday, January 28, 2019

Install Kubeflow on Centos 7

This post summarizes installation of Kubeflow on Centos 7, together with its dependencies.

1) Install and enable the COPR Plugin:
$ sudo yum install yum-plugin-copr

$ sudo yum copr enable ngompa/snapcore-el7
Loaded plugins: copr, fastestmirror, langpacks

You are about to enable a Copr repository. Please note that this
repository is not part of the main Fedora distribution, and quality
may vary.

The Fedora Project does not exercise any power over the contents of
this repository beyond the rules outlined in the Copr FAQ at
, and
packages are not held to any quality or securty level.

Please do not file bug reports about these packages in Fedora
Bugzilla. In case of problems, contact the owner of this repository.

Do you want to continue? [y/N]: Y
copr done

2) Install and enable Snapd:
$ sudo yum -y install snapd

$ sudo systemctl enable --now snapd.socket
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/snapd.socket.

$ sudo ln -s /var/lib/snapd/snap /snap

Now snap is installed. You can confirm it by,
$ snap --help
The snap command lets you install, configure, refresh and remove snaps.
Snaps are packages that work across many different Linux distributions,
enabling secure delivery and operation of the latest apps and utilities.

Usage: snap [...]

Commands can be classified as follows:

         Basics: find, info, install, list, remove
        ...more: refresh, revert, switch, disable, enable
        History: changes, tasks, abort, watch
        Daemons: services, start, stop, restart, logs
       Commands: alias, aliases, unalias, prefer
  Configuration: get, set, wait
        Account: login, logout, whoami
    Permissions: interfaces, interface, connect, disconnect
          Other: version, warnings, okay
    Development: run, pack, try, ack, known, download

For more information about a command, run 'snap help '.
For a short summary of all commands, run 'snap help --all'. 

Install and configure jq:
$ sudo yum install jq -y

$ sudo cat /var/lib/snapd/state.json | jq 'delpaths([["data", "auth", "device"]])' > state.json-new

3) Install MicroK8s:

$ sudo snap install microk8s --classic

2019-01-28T13:46:06-05:00 INFO Waiting for restart...
microk8s v1.13.2 from Canonical✓ installed

Check the currently published versions:
$ snap info microk8s

name:      microk8s
summary:   Kubernetes for workstations and appliances
publisher: Canonical✓
license:   unset
description: |
  MicroK8s is a small, fast, secure, single node Kubernetes that installs on just about any Linux
  box. Use it for offline development, prototyping, testing, or use it on a VM as a small, cheap,
  reliable k8s for CI/CD. It's also a great k8s for appliances - develop your IoT apps for k8s and
  deploy them to MicroK8s on your boxes.
  - microk8s.config
  - microk8s.disable
  - microk8s.docker
  - microk8s.enable
  - microk8s.inspect
  - microk8s.istioctl
  - microk8s.kubectl
  - microk8s.reset
  - microk8s.start
  - microk8s.status
  - microk8s.stop
  microk8s.daemon-apiserver:          simple, enabled, active
  microk8s.daemon-apiserver-kicker:   simple, enabled, active
  microk8s.daemon-controller-manager: simple, enabled, active
  microk8s.daemon-docker:             simple, enabled, active
  microk8s.daemon-etcd:               simple, enabled, active
  microk8s.daemon-kubelet:            simple, enabled, active
  microk8s.daemon-proxy:              simple, enabled, active
  microk8s.daemon-scheduler:          simple, enabled, active
snap-id:      EaXqgt1lyCaxKaQCU349mlodBkDCXRcg
tracking:     stable
refresh-date: today at 13:46 EST
  stable:         v1.13.2  (383) 229MB classic
  candidate:      v1.13.2  (383) 229MB classic
  beta:           v1.13.2  (383) 229MB classic
  edge:           v1.13.2  (383) 229MB classic
  1.13/stable:    v1.13.2  (384) 229MB classic
  1.13/candidate: v1.13.2  (384) 229MB classic
  1.13/beta:      v1.13.2  (384) 229MB classic
  1.13/edge:      v1.13.2  (384) 229MB classic
  1.12/stable:    v1.12.4  (362) 251MB classic
  1.12/candidate: v1.12.4  (362) 251MB classic
  1.12/beta:      v1.12.4  (362) 251MB classic
  1.12/edge:      v1.12.5  (387) 251MB classic
  1.11/stable:    v1.11.6  (361) 245MB classic
  1.11/candidate: v1.11.6  (361) 245MB classic
  1.11/beta:      v1.11.6  (361) 245MB classic
  1.11/edge:      v1.11.7  (389) 245MB classic
  1.10/stable:    v1.10.12 (364) 200MB classic
  1.10/candidate: v1.10.12 (364) 200MB classic
  1.10/beta:      v1.10.12 (364) 200MB classic
  1.10/edge:      v1.10.12 (364) 200MB classic
installed:        v1.13.2  (383) 229MB classic

More information -

4) Install Kubectl:
$ sudo su
# vim /etc/yum.repos.d/kubernetes.repo

# yum install -y kubectl

$ kubectl cluster-info
Kubernetes master is running at http://localhost:8080

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'

Enable Autocompletion:
$ sudo yum install bash-completion -y
$ echo "source <(kubectl completion bash)" >> ~/.bashrc

5) Install Ksonnet:
$ wget
$ tar -xzvf ks_0.13.1_linux_amd64.tar.gz

Include the location to bashrc.
$ vim ~/.bashrc

export PATH=/home/pkathi2/ks_0.13.1_linux_amd64:$PATH

Open a new terminal and confirm that ks is installed.

$ ks --help

You can use the `ks` commands to write, share, and deploy your Kubernetes
application configuration to remote clusters.


  ks [flags]
  ks [command]

Available Commands:
  apply       Apply local Kubernetes manifests (components) to remote clusters
  component   Manage ksonnet components
  delete      Remove component-specified Kubernetes resources from remote clusters
  diff        Compare manifests, based on environment or location (local or remote)
  env         Manage ksonnet environments
  generate    Use the specified prototype to generate a component manifest
  help        Help about any command
  import      Import manifest
  init        Initialize a ksonnet application
  module      Manage ksonnet modules
  param       Manage ksonnet parameters for components and environments
  pkg         Manage packages and dependencies for the current ksonnet application
  prototype   Instantiate, inspect, and get examples for ksonnet prototypes
  registry    Manage registries for current project
  show        Show expanded manifests for a specific environment.
  upgrade     Upgrade ks configuration
  validate    Check generated component manifests against the server's API
  version     Print version information for this ksonnet binary

      --dir string        Ksonnet application root to use; Defaults to CWD (default "/home/pradeeban/programs/ks_0.13.1_linux_amd64")
  -h, --help              help for ks
      --tls-skip-verify   Skip verification of TLS server certificates
  -v, --verbose count     Increase verbosity. May be given multiple times.

Use "ks [command] --help" for more information about a command.

6) Install Kubeflow:

Add the environment variables to the bashrc.
$ vim ~/.bashrc

export KUBEFLOW_TAG=v0.4.1
export KUBEFLOW_SOURCE=/home/pkathi2/kubeflow_src
export KFAPP=kfapp


$ curl${KUBEFLOW_TAG}/scripts/ | bash

$ scripts/ init ${KFAPP} --platform none
$ cd ${KFAPP}

Create Context:

Follow the instructions here.
$ kubectl config --kubeconfig=$HOME/.kube/sa-config set-context svcs-acct-context

Context "svcs-acct-context" created.

$ ${
KUBEFLOW_SOURCE}/scripts/ generate k8s
$ ${
KUBEFLOW_SOURCE}/scripts/ apply k8s

To uninstall:

Remove the entries from bashrc appropriately.

$ sudo yum remove kubectl

$ sudo snap remove microk8s

No comments:

Post a Comment

You are welcome to provide your opinions in the comments. Spam comments and comments with random links will be deleted.