thecodeteam / labs

{code} Projects in Action
MIT License
90 stars 20 forks source link

add new demo for kubernetes with libstorage #5

Closed cantbewong closed 7 years ago

cantbewong commented 7 years ago

created new lab to demo kubernetes with libstorage integration on AWS

kacole2 commented 7 years ago

@cantbewong I'm still having issues following everything. There is definitely some missing steps to be truly spoon-fed.

here is where it's crashing on me. Directions from the very beginning...:

cd ~
curl https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz | tar xvz
sudo chown -R root:root ./go/
sudo mv go /usr/local
echo "export GOPATH=$HOME/work" >> ~/.profile
echo "export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin" >> ~/.profile
source ~/.profile
sudo apt-get update
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y docker-engine
curl -L https://github.com/coreos/etcd/releases/download/v3.0.13/etcd-v3.0.13-linux-amd64.tar.gz | tar xvz
sudo chown -R root:root ./etcd-v3.0.13-linux-amd64/
sudo mv etcd-v3.0.13-linux-amd64/ /usr/local/
sudo ln -s /usr/local/etcd-v3.0.13-linux-amd64/etcd /usr/local/bin/etcd
sudo ln -s /usr/local/etcd-v3.0.13-linux-amd64/etcdctl /usr/local/bin/etcdctl
sudo add-apt-repository ppa:masterminds/glide
sudo apt-get update && sudo apt-get install -y g++ glide make unzip
go get -u github.com/tools/godep
go get -u github.com/jteeuwen/go-bindata/go-bindata
mkdir -p $GOPATH/src/k8s.io
cd $GOPATH/src/k8s.io
git clone https://github.com/vladimirvivien/kubernetes.git
cd kubernetes
git remote add upstream https://github.com/kubernetes/kubernetes.git
git checkout -b libstorage-take4 origin/libstorage-take4
curl -sSL https://dl.bintray.com/emccode/rexray/install | sh -
...add config file...
sudo rexray start
sudo su -
source /home/ubuntu/.profile
export ALLOW_PRIVILEGED=true
export LOG_LEVEL=5
export CLOUD_PROVIDER=aws
export KUBERNETES_PROVIDER=local
cd /home/ubuntu/work/src/k8s.io/kubernetes
hack/local-up-cluster.sh  lookup_pull.py    

root@ip-172-31-39-40:/home/ubuntu/work/src/k8s.io/kubernetes# hack/local-up-cluster.sh  lookup_pull.py
make: Entering directory '/home/ubuntu/work/src/k8s.io/kubernetes'
make[1]: Entering directory '/home/ubuntu/work/src/k8s.io/kubernetes'
+++ [1105 13:08:09] Generating bindata:
    /home/ubuntu/work/src/k8s.io/kubernetes/test/e2e/framework/gobindata_util.go
Cannot find go-bindata. Install with
  go get -u github.com/jteeuwen/go-bindata/go-bindata
  and make sure GOBIN is in the system PATH
../../../../../../test/e2e/framework/gobindata_util.go:19: running "../../../hack/update-bindata.sh": exit status 5
Makefile.generated_files:286: recipe for target '_output/bin/deepcopy-gen' failed
make[1]: *** [_output/bin/deepcopy-gen] Error 1
make[1]: Leaving directory '/home/ubuntu/work/src/k8s.io/kubernetes'
Makefile:287: recipe for target 'generated_files' failed
make: *** [generated_files] Error 2
make: Leaving directory '/home/ubuntu/work/src/k8s.io/kubernetes'
!!! Error in hack/local-up-cluster.sh:120
  'make -C "${KUBE_ROOT}" WHAT="cmd/kubectl cmd/hyperkube"' exited with status 2
Call stack:
  1: hack/local-up-cluster.sh:120 main(...)
Exiting with status 1
kacole2 commented 7 years ago

@cantbewong i'm getting an error with REX-Ray after installation. really odd... got the build of k8 to start but i'm on a plane and it keeps disconnecting. will try again tomorrow

ubuntu@ip-172-31-33-51:~$ sudo rexray service start
● rexray.service - rexray
   Loaded: loaded (/etc/systemd/system/rexray.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2016-11-07 04:00:28 UTC; 38s ago
 Main PID: 758 (rexray)
    Tasks: 7
   Memory: 57.5M
      CPU: 291ms
   CGroup: /system.slice/rexray.service
           └─758 /usr/bin/rexray start -f

Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ################################################################################
Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ##                                                                            ##
Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ##                  libStorage started  - 2016/11/07 04:00:29.773             ##
Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ##                                                                            ##
Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ##     endpoints:   tcp://127.0.0.1:7979                                      ##
Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ##                                                                            ##
Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ##      services:   name=ebs, driver=ebs                                      ##
Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ##                                                                            ##
Nov 07 04:00:29 ip-172-31-33-51 rexray[758]: ################################################################################
Nov 07 04:01:06 ip-172-31-33-51 systemd[1]: Started rexray.
ubuntu@ip-172-31-33-51:~$ sudo rexray volume ls
Oops, an error occured!

  listen tcp 127.0.0.1:7979: bind: address already in use

To correct the error please review:

  - Debug output by using the flag -l debug
  - The REX-ray website at https://github.com/emccode/rexray
  - The on↓ine he↓p be↓ow

List volumes
kacole2 commented 7 years ago

config.yml is incorrect. please use this...

rexray:
  logLevel: debug
libstorage:
  host:     tcp://127.0.0.1:7979
  embedded: true
  service:  ebs
  server:
    endpoints:
      public:
        address: tcp://:7979
    services:
      ebs:
        driver: ebs
ebs:
  accessKey: #{$aws_akey}
  secretKey: #{$aws_skey}
kacole2 commented 7 years ago

getting a 500 error when deploying a k8 pod.

ubuntu@ip-172-31-43-139:~/work/src/k8s.io/kubernetes$ cluster/kubectl.sh describe pod
Name:        mysql
Namespace:    default
Node:        127.0.0.1/127.0.0.1
Start Time:    Mon, 07 Nov 2016 18:01:11 +0000
Labels:        name=mysql
Status:        Pending
IP:
Controllers:    <none>
Containers:
  mysql:
    Container ID:
    Image:        mysql:5.6
    Image ID:
    Port:        3306/TCP
    State:        Waiting
      Reason:        ContainerCreating
    Ready:        False
    Restart Count:    0
    Volume Mounts:
      /var/lib/mysql from mysql-persistent-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-0bmm6 (ro)
    Environment Variables:
      MYSQL_ROOT_PASSWORD:    yourpassword
Conditions:
  Type        Status
  Initialized     True
  Ready     False
  PodScheduled     True
Volumes:
  mysql-persistent-volume:
    Type:    LibStorage (a volume managed by LibStorage)
    Host:    http://127.0.0.1:7979
    Service:    ebs
    VolumeName:    mysql-1
    FSType:
    ReadOnly:    false
  default-token-0bmm6:
    Type:    Secret (a volume populated by a Secret)
    SecretName:    default-token-0bmm6
QoS Class:    BestEffort
Tolerations:    <none>
Events:
  FirstSeen    LastSeen    Count    From            SubObjectPath    Type        Reason        Message
  ---------    --------    -----    ----            -------------    --------    ------        -------
  55s        55s        1    {default-scheduler }            Normal        Scheduled    Successfully assigned mysql to 127.0.0.1
  55s        23s        7    {controller-manager }            Warning        FailedMount    Failed to attach volume "mysql-persistent-volume" on node "127.0.0.1" with: unexpected http status code 500
cantbewong commented 7 years ago

Will resubmit as a new PR