Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitRepo volume mounting fails in Kubernetes envrionment #4976

Closed
girishshilamkar opened this issue Jun 1, 2016 · 2 comments
Closed

gitRepo volume mounting fails in Kubernetes envrionment #4976

girishshilamkar opened this issue Jun 1, 2016 · 2 comments
Assignees
Labels
area/kubernetes kind/feature Issues that represent larger new pieces of functionality, not enhancements to existing functionality
Milestone

Comments

@girishshilamkar
Copy link

Rancher Version:
v1.1.0-dev3

Docker Version:
1.10.3 build 20f81dd

OS and where are the hosts located? (cloud, bare metal, etc):
ubuntu 14.04

Setup Details: (single node rancher vs. HA rancher, internal DB vs. external DB)

Environment Type: (Cattle/Kubernetes/Swarm/Mesos)
Kubernetes

Steps to Reproduce:

  • Install Rancher (Server and host are different nodes)
  • Create K8s environment
  • Create RC with following yaml or any standard example for K8s git-Repo volume:
apiVersion: v1
kind: ReplicationController
metadata:
  name: prometheus-controller
  namespace: default
spec:
  replicas: 1
  selector:
  template:
    metadata:
      labels: 
        name: prometheus
    spec:
      restartPolicy: Always
      containers:
      - image: prom/prometheus:0.17.0
        command: 
          -  -alertmanager.url=http://alertmanager:9093 -config.file=/etc/prom-conf/prometheus.yml -storage.local.path=/prometheus -web.console.libraries=/etc/prometheus/console_libraries -web.console.templates=/etc/prometheus/consoles
        imagePullPolicy: Always
        name: prometheus
        volumeMounts:
        - mountPath: /etc/prom-conf 
          name: prom-conf
      volumes:
      - name: prom-conf
        gitRepo:
          repository: git@github.com:infracloudio/prom-conf.git

Results:

$ kubectl describe pods prometheus-controller-6btku
Name: prometheus-controller-6btku
Namespace: default
Image(s): prom/prometheus:0.17.0
Node: ubuntu1404-2-k/192.168.99.103
Start Time: Wed, 01 Jun 2016 07:21:49 +0000
Labels: name=prometheus
Status: Pending
Reason:
Message:
IP:
Replication Controllers: prometheus-controller (1/1 replicas created)
Containers:
  prometheus:
    Container ID:
    Image: prom/prometheus:0.17.0
    Image ID:
    State: Waiting
      Reason: ContainerCreating
    Ready: False
    Restart Count: 0
    Environment Variables:
Conditions:
  Type Status
  Ready False
Volumes:
  prom-conf:
    Type: GitRepo (a volume that is pulled from git when the pod is created)
    Repository: git@github.com:infracloudio/prom-conf.git
    Revision:
Events:
  FirstSeen LastSeen Count From SubobjectPath Reason Message
  ───────── ──────── ───── ──── ───────────── ────── ───────
  23m 23m 1 {default-scheduler } Scheduled Successfully assigned prometheus-controller-6btku to ubuntu1404-2-k
  23m 16m 32 {kubelet ubuntu1404-2-k} FailedMount Unable to mount volumes for pod "prometheus-controller-6btku_default(8123964b-27c9-11e6-ab6f-023dfcd9e6aa)": failed to exec 'git clone git@github.com:infracloudio/prom-conf.git': : executable file not found in $PATH
  23m 16m 32 {kubelet ubuntu1404-2-k} FailedSync Error syncing pod, skipping: failed to exec 'git clone git@github.com:infracloudio/prom-conf.git': : executable file not found in $PATH
  15m 4s 70 {kubelet ubuntu1404-2-k} FailedMount Unable to mount volumes for pod "prometheus-controller-6btku_default(8123964b-27c9-11e6-ab6f-023dfcd9e6aa)": failed to exec 'git clone git@github.com:infracloudio/prom-conf.git': : executable file not found in $PATH
  15m 4s 70 {kubelet ubuntu1404-2-k} FailedSync Error syncing pod, skipping: failed to exec 'git clone git@github.com:infracloudio/prom-conf.git': : executable file not found in $PATH

kubelet log

docker logs -f  1c8eeb77c6d3
E0601 14:48:42.289695   17779 pod_workers.go:138] Error syncing pod 5e0de60f-2806-11e6-810f-0258c6bb78f8, skipping: failed to exec 'git clone git@github.com:infracloudio/prom-conf.git': : executable file not found in $PATH

I thought git was not installed in kubelet, but that is not the case:

docker exec -it 1c8eeb77c6d3 bash
# git
usage: git [--version] [--help] [-C <path>] [-c name=value]
          [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
          [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
          [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
          <command> [<args>]

Expected:
git-Repo volume should have been mounted

@alena1108
Copy link

Could you test it? should be fixed with the latest k8s in qa branch

@galal-hussein
Copy link
Contributor

@alena1108 I tested it on latest Rancher master build image with the latest k8s version in qa branch (k8s 1.4) and it worked, here are my steps:

  • Install k8s 1.4 stack
  • Run the following pod:
apiVersion: v1
kind: Pod
metadata:
  name: server
spec:
  containers:
  - image: nginx
    name: nginx
    volumeMounts:
    - mountPath: /usr/share/nginx/html/
      name: git-volume
  volumes:
  - name: git-volume
    gitRepo:
      repository: "https://github.com/galal-hussein/testk8s.git"

The pod created and i was able to verify by exec to the container and check:

root@server:/# ls /usr/share/nginx/html/testk8s/
index.html
root@server:/# cat /usr/share/nginx/html/testk8s/index.html
gitrepo volume is working
root@server:/#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes kind/feature Issues that represent larger new pieces of functionality, not enhancements to existing functionality
Projects
None yet
Development

No branches or pull requests

4 participants