GithubHelp home page GithubHelp logo

Comments (7)

curx avatar curx commented on May 12, 2024 1

an example for setting up a host-path-provisoner #85 (comment)

from k3s.

flxs avatar flxs commented on May 12, 2024 1

@warmchang hostPath volumes are always owned by root; this complicates things considerably when using pre-built containers that run their process(es) as another user. The localPath provisioner described in #85 does pretty much the same but via PVCs, which don't seem to suffer from the owned-by-root issue.

from k3s.

brandond avatar brandond commented on May 12, 2024 1

https://rancher.com/docs/k3s/latest/en/storage/

from k3s.

flxs avatar flxs commented on May 12, 2024

Struggling with this too; is it possible to get that to work? If so, a few pointers in the general direction would be very helpful.

from k3s.

warmchang avatar warmchang commented on May 12, 2024

I prefer to use volume of the hostpath type directly.

An example:

$ k3s kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.3-k3s.6", GitCommit:"da4e14f160174f356b1d95198f48439971cc8a85", GitTreeState:"clean", BuildDate:"2019-02-24T05:21+00:00Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.3-k3s.6", GitCommit:"da4e14f160174f356b1d95198f48439971cc8a85", GitTreeState:"clean", BuildDate:"2019-02-24T05:21+00:00Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}
$ alias k="k3s kubectl"
$ cat pod-hostpath.yaml
apiVersion: v1
kind: Pod
metadata:
  name: test-pd
spec:
  containers:
  - image: k8s.gcr.io/test-webserver
    name: test-container
    volumeMounts:
    - mountPath: /test-pd
      name: test-volume
  volumes:
  - name: test-volume
    hostPath:
      path: /data
      type: Directory
$
$ k apply -f pod-hostpath.yaml
pod/test-pd created
$ k get pods
NAME                   READY   STATUS    RESTARTS   AGE
http-8654dd748-fjdkc   1/1     Running   0          9m22s
test-pd                1/1     Running   0          13s
$ k get pod test-pd -o yaml
apiVersion: v1
kind: Pod
......
    name: test-container
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /test-pd
      name: test-volume
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: default-token-vz4pc
      readOnly: true
  dnsPolicy: ClusterFirst
......
  volumes:
  - hostPath:
      path: /data
      type: Directory
    name: test-volume
  - name: default-token-vz4pc
    secret:
      defaultMode: 420
      secretName: default-token-vz4pc
status:
......
    restartCount: 0
    state:
      running:
        startedAt: "2019-02-28T11:24:20Z"
  hostIP: 172.17.0.20
  phase: Running
  podIP: 10.42.0.7
  qosClass: BestEffort
  startTime: "2019-02-28T11:24:19Z"
$
$ k cluster-info
Kubernetes master is running at https://localhost:6443
CoreDNS is running at https://localhost:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

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

If switch to CSI implementation, I need to install Provisioner, Driver, Attacher and Registrar plugins, which seems too complex.

The following two articles describe the content related to the CSI host-path for reference:

  1. https://kubernetes-csi.github.io/docs/example.html
  2. https://github.com/Azure/kubernetes-volume-drivers/tree/master/csi/hostpath

Just my 2 cents. ☸☸ πŸ˜ƒ

from k3s.

double16 avatar double16 commented on May 12, 2024

My use case is for CI. If I change from PVC then it's not testing my config. Also, one particular application uses Helm to package and uses dependencies. Those dependencies use PVC. It'd be easier for me to install a plugin.

from k3s.

double16 avatar double16 commented on May 12, 2024

from k3s.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.