chunk_id large_stringlengths 36 36 | doc_type large_stringclasses 2
values | category large_stringclasses 17
values | document large_stringclasses 50
values | version_raw large_stringclasses 590
values | chunk_index int64 0 262 | text large_stringlengths 11 5.69k | file_path large_stringclasses 882
values |
|---|---|---|---|---|---|---|---|
902c2b04-4686-534f-81de-667bbd527183 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 7 | kubectl get pv task-pv-volume
```
Now the output shows a `STATUS` of `Bound`.
```None
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual ... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
3bd351a6-4e1d-5174-9d72-c8afef33d69c | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 8 | [`pods/storage/pv-pod.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/pods/storage/pv-pod.yaml)
```None
apiVersion: v1
kind: Pod
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage
... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
afe6973b-3c73-51ee-b58a-aea416d5c3b3 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 9 | Get a shell to the container running in your Pod:
```None
kubectl exec -it task-pv-pod -- /bin/bash
```
In your shell, verify that nginx is serving the `index.html` file from the
hostPath volume:
```None
# Be sure to run these 3 commands inside the root shell that comes from
# running "kubectl exec" in the previous ... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
bde5a85d-e73a-5d5f-996c-383e5a406d34 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 10 | [`pods/storage/pv-duplicate.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/pods/storage/pv-duplicate.yaml)
```None
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- name: te... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
b2efe75f-ec3f-517c-9cf6-9c84e0b76945 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 11 | Since the first subPath is `html`, an `html` directory has to be created within `/mnt/data/`
on the node.
The second subPath `nginx.conf` means that a file within the `/mnt/data/` directory will be used. No other directory
needs to be created.
Two volume mounts will be made on your nginx container:
* `/usr/share/ngi... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
3a03e70a-ab0b-5a5c-b020-1a16f15ab023 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 12 | Move index.html into the directory:
```None
# Move index.html from its current location to the html sub-directory
sudo mv /mnt/data/index.html html
```
### Create a new nginx.conf file
[`pods/storage/nginx.conf`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/pods/storage/nginx... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
62c063a0-2bdb-5c9a-b6c3-536d205e44a8 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 13 | #gzip on;
include /etc/nginx/conf.d/*.conf;
```
}
```
This is a modified version of the default `nginx.conf` file. Here, the default `keepalive_timeout` has been
modified to `60`
Create the nginx.conf file:
```None
cat <<EOF > /mnt/data/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/e... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
4db15a25-af60-5686-bf9b-854ffe1a34a6 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 14 | ### Create a Pod
Here we will create a pod that uses the existing persistentVolume and persistentVolumeClaim.
However, the pod mounts only a specific file, `nginx.conf`, and directory, `html`, to the container.
Create the Pod:
```None
kubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml
```
Verif... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
abb1982a-77e5-5f4d-a6df-ab43e5cab2d1 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 15 | # Be sure to run these commands inside the root shell that comes from
# running "kubectl exec" in the previous step
cat /etc/nginx/nginx.conf | grep keepalive_timeout
```
The output shows the modified text that you wrote to the `nginx.conf` file on the
hostPath volume:
```None
keepalive_timeout 60;
```
If you see t... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
809b7304-8f0a-5e96-9716-877e3e07de10 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 16 | ## Access control
Storage configured with a group ID (GID) allows writing only by Pods using the same
GID. Mismatched or missing GIDs cause permission denied errors. To reduce the
need for coordination with users, an administrator can annotate a PersistentVolume
with a GID. Then the GID is automatically added to any P... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
4e5b6d25-5ccb-57b1-8c40-f5f2b1a3d842 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 17 | #### Note:
When a Pod consumes a PersistentVolume, the GIDs associated with the
PersistentVolume are not present on the Pod resource itself.
## What's next
* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/).
* Read the [Persistent Storage design document](https://git.k8s.io/design-pro... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
97ee4ca6-9f69-5664-ad30-a5d17fab8df8 | docs | kubernetes | kubernetes_persistent-volume-storage | v133 | 18 | [Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes).
Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to
[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io)
or
[suggest an improvement](https://github.com/kub... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md |
432c3f94-c67e-544c-bf1c-60a9bdf944cb | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 0 | # Configure a Pod to Use a PersistentVolume for Storage
Source: https://v1-34.docs.kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/
Version: v1.34
1. [Kubernetes Documentation](https://kubernetes.io/docs/)
2. [Tasks](https://kubernetes.io/docs/tasks/)
3. [Configure Pods and Contai... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
1b09f210-1602-569a-b79b-bb4cea566331 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 1 | [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims "Claims storage resources defined in a PersistentVolume so that it can be mounted as a volume in a container.")
for storage.
Here is a summary of the process:
1. You, as cluster administrator, create a PersistentVolume backed by ... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
9123b973-ec1c-54bb-b8b8-e90e48c91710 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 2 | * Familiarize yourself with the material in
[Persistent Volumes](/docs/concepts/storage/persistent-volumes/).
## Create an index.html file on your Node
Open a shell to the single Node in your cluster. How you open a shell depends
on how you set up your cluster. For example, if you are using Minikube, you
can open a... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
ab70d788-91f0-56c8-a455-3cd17d69271b | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 3 | The output should be:
```None
Hello from Kubernetes storage
```
You can now close the shell to your Node.
## Create a PersistentVolume
In this exercise, you create a *hostPath* PersistentVolume. Kubernetes supports
hostPath for development and testing on a single-node cluster. A hostPath
PersistentVolume uses a fil... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
596e70bd-07b4-5f75-b56b-5a3dc6848f1e | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 4 | [`pods/storage/pv-volume.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/pv-volume.yaml)
```None
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume
labels:
type: ... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
d4efa269-781a-5f06-b93d-cae6ebe55ca1 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 5 | #### Note:
This example uses the `ReadWriteOnce` access mode, for simplicity. For
production use, the Kubernetes project recommends using the `ReadWriteOncePod`
access mode instead.
Create the PersistentVolume:
```None
kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml
```
View information about t... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
17494f52-3397-51fc-90d6-3ace2302acbf | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 6 | that requests a volume of at least three gibibytes that can provide read-write
access for at most one Node at a time.
Here is the configuration file for the PersistentVolumeClaim:
[`pods/storage/pv-claim.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/pv-claim... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
0cf9c592-f334-5e75-adee-00354eae01b8 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 7 | kubectl get pv task-pv-volume
```
Now the output shows a `STATUS` of `Bound`.
```None
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual ... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
8997477a-c28d-5909-8d96-45ae9d00b866 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 8 | [`pods/storage/pv-pod.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/pv-pod.yaml)
```None
apiVersion: v1
kind: Pod
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage
... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
6aabea2d-6605-52b8-8aa2-509646baf620 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 9 | Get a shell to the container running in your Pod:
```None
kubectl exec -it task-pv-pod -- /bin/bash
```
In your shell, verify that nginx is serving the `index.html` file from the
hostPath volume:
```None
# Be sure to run these 3 commands inside the root shell that comes from
# running "kubectl exec" in the previous ... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
e43640e7-bdd5-56de-89a7-35b665fb27a9 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 10 | [`pods/storage/pv-duplicate.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/pv-duplicate.yaml)
```None
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- name: te... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
0aef0d7f-9775-57be-beef-835b8e2b21eb | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 11 | Since the first subPath is `html`, an `html` directory has to be created within `/mnt/data/`
on the node.
The second subPath `nginx.conf` means that a file within the `/mnt/data/` directory will be used. No other directory
needs to be created.
Two volume mounts will be made on your nginx container:
* `/usr/share/ngi... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
508dfd6d-af55-5ae6-b248-09a19505b386 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 12 | Move index.html into the directory:
```None
# Move index.html from its current location to the html sub-directory
sudo mv /mnt/data/index.html html
```
### Create a new nginx.conf file
[`pods/storage/nginx.conf`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/nginx... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
15708abb-b559-5226-9067-9c062d1e47fe | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 13 | #gzip on;
include /etc/nginx/conf.d/*.conf;
```
}
```
This is a modified version of the default `nginx.conf` file. Here, the default `keepalive_timeout` has been
modified to `60`
Create the nginx.conf file:
```None
cat <<EOF > /mnt/data/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/e... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
4857e6aa-fa47-5c94-b7d8-9d7e7f4b3b60 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 14 | ### Create a Pod
Here we will create a pod that uses the existing persistentVolume and persistentVolumeClaim.
However, the pod mounts only a specific file, `nginx.conf`, and directory, `html`, to the container.
Create the Pod:
```None
kubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml
```
Verif... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
fac3fad3-a9db-5814-9ea7-133d69a8ca6e | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 15 | # Be sure to run these commands inside the root shell that comes from
# running "kubectl exec" in the previous step
cat /etc/nginx/nginx.conf | grep keepalive_timeout
```
The output shows the modified text that you wrote to the `nginx.conf` file on the
hostPath volume:
```None
keepalive_timeout 60;
```
If you see t... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
ed37b605-0a6b-5dce-ac46-083de22e9662 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 16 | ## Access control
Storage configured with a group ID (GID) allows writing only by Pods using the same
GID. Mismatched or missing GIDs cause permission denied errors. To reduce the
need for coordination with users, an administrator can annotate a PersistentVolume
with a GID. Then the GID is automatically added to any P... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
f134b2dd-0ec1-5ca2-8dd7-8820bad18bdf | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 17 | #### Note:
When a Pod consumes a PersistentVolume, the GIDs associated with the
PersistentVolume are not present on the Pod resource itself.
## What's next
* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/).
* Read the [Persistent Storage design document](https://git.k8s.io/design-pro... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
13dc6ec5-718f-55fb-a278-b72d933d0562 | docs | kubernetes | kubernetes_persistent-volume-storage | v134 | 18 | [Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes).
Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to
[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io)
or
[suggest an improvement](https://github.com/kub... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md |
21dca5e5-6306-5d96-8887-e948eb2fcca0 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 0 | # Configure a Pod to Use a PersistentVolume for Storage
Source: https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/
Version: v1.35
1. [Kubernetes Documentation](https://kubernetes.io/docs/)
2. [Tasks](https://kubernetes.io/docs/tasks/)
3. [Configure Pods and Containers](https... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
7f42e79b-0f9d-556f-8479-22323ae55fec | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 1 | 2. You, now taking the role of a developer / cluster user, create a
PersistentVolumeClaim that is automatically bound to a suitable
PersistentVolume.
3. You create a Pod that uses the above PersistentVolumeClaim for storage.
## Before you begin
* You need to have a Kubernetes cluster that has only one Node, and... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
507ad2ba-3910-51b9-bd6d-735172754a03 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 2 | In your shell on that Node, create a `/mnt/data` directory:
```None
# This assumes that your Node uses "sudo" to run commands
# as the superuser
sudo mkdir /mnt/data
```
In the `/mnt/data` directory, create an `index.html` file:
```None
# This again assumes that your Node uses "sudo" to run commands
# as the superus... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
eeb5324f-052d-5c32-ab83-7d38f9b23440 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 3 | PersistentVolume uses a file or directory on the Node to emulate network-attached storage.
In a production cluster, you would not use hostPath. Instead a cluster administrator
would provision a network resource like a Google Compute Engine persistent disk,
an NFS share, or an Amazon Elastic Block Store volume. Cluster... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
322be6f2-8852-5f62-9918-23e350871082 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 4 | path: "/mnt/data"
```
The configuration file specifies that the volume is at `/mnt/data` on the
cluster's Node. The configuration also specifies a size of 10 gibibytes and
an access mode of `ReadWriteOnce`, which means the volume can be mounted as
read-write by a single Node. It defines the [StorageClass name](/do... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
e2b58e42-50bf-53ed-bca6-8b7a43bbfd52 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 5 | NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
task-pv-volume 10Gi RWO Retain Available manual 4s
```
## Create a PersistentVolumeClaim
The next step is to create a PersistentVolumeClaim. Pods use Pe... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
09ea5a5d-2e7b-53dc-af06-6f1d77523c13 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 6 | Create the PersistentVolumeClaim:
```None
kubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml
```
After you create the PersistentVolumeClaim, the Kubernetes control plane looks
for a PersistentVolume that satisfies the claim's requirements. If the control
plane finds a suitable PersistentVolume with t... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
a87bf1f2-5dd4-5ae4-be9e-41a5a6fc8e24 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 7 | NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s
```
## Create a Pod
The next step is to create a Pod that uses your PersistentVolumeClaim as a volume.
Here is the configuration file for the P... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
c76093f3-6def-5cd0-abdf-395fd75064f5 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 8 | it does not specify a PersistentVolume. From the Pod's point of view, the claim
is a volume.
Create the Pod:
```None
kubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml
```
Verify that the container in the Pod is running:
```None
kubectl get pod task-pv-pod
```
Get a shell to the container running in... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
abbfa0aa-f467-525a-9317-917f97f0c47b | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 9 | ## Clean up
Delete the Pod:
```None
kubectl delete pod task-pv-pod
```
## Mounting the same PersistentVolume in two places
You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount
the volume to a single location in a container. Let's explore how you can mount the same Persisten... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
d573b344-8e49-573e-87f0-297836c1e8bb | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 10 | - name: config
persistentVolumeClaim:
claimName: task-pv-claim
```
Here:
* `subPath`: This field allows specific files or directories from the mounted PersistentVolume to be exposed at
different locations within the container. In this example:
+ `subPath: html` mounts the html directory.
+ `su... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
227e2c55-8797-57b5-833e-fba2ead5e28e | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 11 | Open a shell to the single Node in your cluster. How you open a shell depends on how you set up your cluster.
For example, if you are using Minikube, you can open a shell to your Node by entering `minikube ssh`.
Create a `/mnt/data/html` directory:
```None
# This assumes that your Node uses "sudo" to run commands
# a... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
8aa33cb4-e3a0-5e73-b29a-8bd030159466 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 12 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile o... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
8dd76539-4f9f-5533-85ac-df03a5fa713d | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 13 | '"\$http_user_agent" "\$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 60;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
EOF
```
### Create a Pod
Here we will create a pod that uses the... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
68f8984b-3b6c-54d9-967d-c79faec9b772 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 14 | curl http://localhost/
```
The output shows the text that you wrote to the `index.html` file on the
hostPath volume:
```None
Hello from Kubernetes storage
```
In your shell, also verify that nginx is serving the `nginx.conf` file from the
hostPath volume:
```None
# Be sure to run these commands inside the root shel... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
dff35375-72bc-59d5-91f6-a9b1f1c3bbaa | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 15 | In the shell on your Node, remove the file and directory that you created:
```None
# This assumes that your Node uses "sudo" to run commands
# as the superuser
sudo rm /mnt/data/html/index.html
sudo rm /mnt/data/nginx.conf
sudo rmdir /mnt/data
```
You can now close the shell to your Node.
## Access control
Storage ... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
e1aa96a4-b767-53a9-9958-5ae9a94c1836 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 16 | Pod's security context are. Every GID, whether it originates from a PersistentVolume
annotation or the Pod's specification, is applied to the first process run in
each container.
#### Note:
When a Pod consumes a PersistentVolume, the GIDs associated with the
PersistentVolume are not present on the Pod resource itself... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
8dbccfe3-fa24-56b4-b49f-ac3a97067f31 | docs | kubernetes | kubernetes_persistent-volume-storage | v135 | 17 | ## Feedback
Was this page helpful?
Yes
No
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on
[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes).
Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you wa... | large_dataset/raw/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md |
c53a5556-ec2e-5cf0-adbf-b1b128bd7616 | docs | kubernetes | kubernetes_tools | v131 | 0 | # Install Tools
Source: https://v1-31.docs.kubernetes.io/docs/tasks/tools/
Version: v1.31
1. [Kubernetes Documentation](https://kubernetes.io/docs/)
2. [Tasks](https://kubernetes.io/docs/tasks/)
3. [Install Tools](https://kubernetes.io/docs/tasks/tools/)
### You are viewing documentation for Kubernetes version: v1.3... | large_dataset/raw/docs/kubernetes/tools/tools_v131.md |
85cc9ec7-8fe4-5923-8692-a11c604acc93 | docs | kubernetes | kubernetes_tools | v131 | 1 | kubectl is installable on a variety of Linux platforms, macOS and Windows.
Find your preferred operating system below.
* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/)
* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/)
* [Install kubectl on Windows](/docs/tasks/tools/install-k... | large_dataset/raw/docs/kubernetes/tools/tools_v131.md |
b8e97afd-945b-5841-aaeb-005a88461016 | docs | kubernetes | kubernetes_tools | v131 | 2 | computer (including Windows, macOS and Linux PCs) so that you can try out
Kubernetes, or for daily development work.
You can follow the official
[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is
on getting the tool installed.
[View minikube Get Started! Guide](https://minikube.sigs.k8s.i... | large_dataset/raw/docs/kubernetes/tools/tools_v131.md |
5d5bd47b-451f-5991-a87e-35f21e87fe5e | docs | kubernetes | kubernetes_tools | v131 | 3 | [View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
## Feedback
Was this page helpful?
Yes
No
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on
[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes... | large_dataset/raw/docs/kubernetes/tools/tools_v131.md |
4c9ce231-421d-5563-b832-a22936253ed5 | docs | kubernetes | kubernetes_tools | v132 | 0 | # Install Tools
Source: https://v1-32.docs.kubernetes.io/docs/tasks/tools/
Version: v1.32
1. [Kubernetes Documentation](https://kubernetes.io/docs/)
2. [Tasks](https://kubernetes.io/docs/tasks/)
3. [Install Tools](https://kubernetes.io/docs/tasks/tools/)
### You are viewing documentation for Kubernetes version: v1.3... | large_dataset/raw/docs/kubernetes/tools/tools_v132.md |
f017196e-2e77-5ef8-9cfa-2b6675eaebb3 | docs | kubernetes | kubernetes_tools | v132 | 1 | kubectl is installable on a variety of Linux platforms, macOS and Windows.
Find your preferred operating system below.
* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/)
* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/)
* [Install kubectl on Windows](/docs/tasks/tools/install-k... | large_dataset/raw/docs/kubernetes/tools/tools_v132.md |
7ac865c2-12a2-5a5a-84d3-529b360f7f6f | docs | kubernetes | kubernetes_tools | v132 | 2 | computer (including Windows, macOS and Linux PCs) so that you can try out
Kubernetes, or for daily development work.
You can follow the official
[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is
on getting the tool installed.
[View minikube Get Started! Guide](https://minikube.sigs.k8s.i... | large_dataset/raw/docs/kubernetes/tools/tools_v132.md |
481c51cd-61e3-566b-91b2-5bb1b5508105 | docs | kubernetes | kubernetes_tools | v132 | 3 | [View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
## Feedback
Was this page helpful?
Yes
No
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on
[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes... | large_dataset/raw/docs/kubernetes/tools/tools_v132.md |
357a912f-b455-5151-9920-1c40a1c0d7cd | docs | kubernetes | kubernetes_tools | v133 | 0 | # Install Tools
Source: https://v1-33.docs.kubernetes.io/docs/tasks/tools/
Version: v1.33
1. [Kubernetes Documentation](https://kubernetes.io/docs/)
2. [Tasks](https://kubernetes.io/docs/tasks/)
3. [Install Tools](https://kubernetes.io/docs/tasks/tools/)
### You are viewing documentation for Kubernetes version: v1.3... | large_dataset/raw/docs/kubernetes/tools/tools_v133.md |
228962f9-cb17-50b9-8e36-bceb4d87339b | docs | kubernetes | kubernetes_tools | v133 | 1 | kubectl is installable on a variety of Linux platforms, macOS and Windows.
Find your preferred operating system below.
* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/)
* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/)
* [Install kubectl on Windows](/docs/tasks/tools/install-k... | large_dataset/raw/docs/kubernetes/tools/tools_v133.md |
9b440ca1-7574-58ae-9e5a-dff91eab4cb1 | docs | kubernetes | kubernetes_tools | v133 | 2 | computer (including Windows, macOS and Linux PCs) so that you can try out
Kubernetes, or for daily development work.
You can follow the official
[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is
on getting the tool installed.
[View minikube Get Started! Guide](https://minikube.sigs.k8s.i... | large_dataset/raw/docs/kubernetes/tools/tools_v133.md |
3f043cf9-33e4-5f5c-bc78-89a2d9078f17 | docs | kubernetes | kubernetes_tools | v133 | 3 | [View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
## Feedback
Was this page helpful?
Yes
No
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on
[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes... | large_dataset/raw/docs/kubernetes/tools/tools_v133.md |
985eeb17-caf7-563d-b345-1b983264aab0 | docs | kubernetes | kubernetes_tools | v134 | 0 | # Install Tools
Source: https://v1-34.docs.kubernetes.io/docs/tasks/tools/
Version: v1.34
1. [Kubernetes Documentation](https://kubernetes.io/docs/)
2. [Tasks](https://kubernetes.io/docs/tasks/)
3. [Install Tools](https://kubernetes.io/docs/tasks/tools/)
### You are viewing documentation for Kubernetes version: v1.3... | large_dataset/raw/docs/kubernetes/tools/tools_v134.md |
f6ecb78a-82f4-5a7e-aa01-a7da790026e7 | docs | kubernetes | kubernetes_tools | v134 | 1 | kubectl is installable on a variety of Linux platforms, macOS and Windows.
Find your preferred operating system below.
* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/)
* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/)
* [Install kubectl on Windows](/docs/tasks/tools/install-k... | large_dataset/raw/docs/kubernetes/tools/tools_v134.md |
97c5e7af-0b57-5bdd-8a93-518fe7f9d897 | docs | kubernetes | kubernetes_tools | v134 | 2 | computer (including Windows, macOS and Linux PCs) so that you can try out
Kubernetes, or for daily development work.
You can follow the official
[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is
on getting the tool installed.
[View minikube Get Started! Guide](https://minikube.sigs.k8s.i... | large_dataset/raw/docs/kubernetes/tools/tools_v134.md |
74c8cf5a-945e-53ea-8e10-17fa4cc9338d | docs | kubernetes | kubernetes_tools | v134 | 3 | [View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
## Feedback
Was this page helpful?
Yes
No
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on
[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes... | large_dataset/raw/docs/kubernetes/tools/tools_v134.md |
e06082b9-8c7d-5463-86e4-a3656bbbc72f | docs | kubernetes | kubernetes_tools | v135 | 0 | # Install Tools
Source: https://kubernetes.io/docs/tasks/tools/
Version: v1.35
1. [Kubernetes Documentation](https://kubernetes.io/docs/)
2. [Tasks](https://kubernetes.io/docs/tasks/)
3. [Install Tools](https://kubernetes.io/docs/tasks/tools/)
Set up Kubernetes tools on your computer.
#### Note:
See the [Learning ... | large_dataset/raw/docs/kubernetes/tools/tools_v135.md |
3c3198be-2d21-5c13-8f96-eea9221dd9e7 | docs | kubernetes | kubernetes_tools | v135 | 1 | * [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/)
* [Install kubectl on Windows](/docs/tasks/tools/install-kubectl-windows/)
## kind
[`kind`](https://kind.sigs.k8s.io/) lets you run Kubernetes on
your local computer. This tool requires that you have either
[Docker](https://www.docker.com/) or [Po... | large_dataset/raw/docs/kubernetes/tools/tools_v135.md |
20bd6e60-ed9b-54c0-9795-c55534cc2d2b | docs | kubernetes | kubernetes_tools | v135 | 2 | on getting the tool installed.
[View minikube Get Started! Guide](https://minikube.sigs.k8s.io/docs/start/)
Once you have `minikube` working, you can use it to
[run a sample application](/docs/tutorials/hello-minikube/).
## kubeadm
You can use the [kubeadm](/docs/reference/setup-tools/kubeadm/ "A tool for quickly i... | large_dataset/raw/docs/kubernetes/tools/tools_v135.md |
2da03fd9-8c96-593e-adb1-dd254821c985 | docs | kubernetes | kubernetes_tools | v135 | 3 | ## Feedback
Was this page helpful?
Yes
No
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on
[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes).
Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you wa... | large_dataset/raw/docs/kubernetes/tools/tools_v135.md |
5e00d433-62da-5735-905a-af1ae074d32e | docs | nodejs | nodejs_addons | 010x | 0 | # Addons#
Source: https://nodejs.org/docs/latest-v0.10.x/api/addons.html
Version: 0.10.x
Addons are dynamically linked shared objects. They can provide glue to C and
C++ libraries. The API (at the moment) is rather complex, involving
knowledge of several libraries:
* V8 JavaScript, a C++ library. Used for interfacin... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
ace866c9-588a-5c02-8ea8-2ff486865a88 | docs | nodejs | nodejs_addons | 010x | 1 | Node statically compiles all its dependencies into the executable.
When compiling your module, you don't need to worry about linking to
any of these libraries.
All of the following examples are available for
[download](https://github.com/rvagg/node-addon-examples) and may be
used as a starting-point for your own Addon... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
e295ca9e-8b3e-5ceb-acc7-41f199df17d7 | docs | nodejs | nodejs_addons | 010x | 2 | void Initialize (Handle<Object> exports);
NODE_MODULE(module_name, Initialize)
```
There is no semi-colon after `NODE_MODULE` as it's not a function (see `node.h`).
The `module_name` needs to match the filename of the final binary (minus the
.node suffix).
The source code needs to be built into `hello.node`, the bin... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
347dfbec-98a9-5906-a914-880d3c1c22cf | docs | nodejs | nodejs_addons | 010x | 3 | in `build/Release/`.
You can now use the binary addon in a Node project `hello.js` by pointing `require` to
the recently built `hello.node` module:
```None
var addon = require('./build/Release/hello');
console.log(addon.hello()); // 'world'
```
Please see patterns below for further information or
<https://github.c... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
c31fae5e-df97-5678-a2a3-a9b59b772e8d | docs | nodejs | nodejs_addons | 010x | 4 | In cases where there is more than one `.cc` file, simply add the file name to the
`sources` array, e.g.:
```None
"sources": ["addon.cc", "myexample.cc"]
```
Now that you have your `binding.gyp` ready, you can configure and build the
addon:
```None
$ node-gyp configure build
```
### Function arguments[#](#addons_fun... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
9e0d520c-be16-5913-8c26-5d192e8094f3 | docs | nodejs | nodejs_addons | 010x | 5 | Local<Number> num = Number::New(args[0]->NumberValue() +
args[1]->NumberValue());
return scope.Close(num);
}
void Init(Handle<Object> exports) {
exports->Set(String::NewSymbol("add"),
FunctionTemplate::New(Add)->GetFunction());
}
NODE_MODULE(addon, Init)
```
You can test it with the following JavaS... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
c816f513-6dd1-532b-bc8d-4966f22f699b | docs | nodejs | nodejs_addons | 010x | 6 | void Init(Handle<Object> exports, Handle<Object> module) {
module->Set(String::NewSymbol("exports"),
FunctionTemplate::New(RunCallback)->GetFunction());
}
NODE_MODULE(addon, Init)
```
Note that this example uses a two-argument form of `Init()` that receives
the full `module` object as the second argument. Thi... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
99970cec-1635-52c6-95f3-5d87e57e6b50 | docs | nodejs | nodejs_addons | 010x | 7 | Local<Object> obj = Object::New();
obj->Set(String::NewSymbol("msg"), args[0]->ToString());
return scope.Close(obj);
}
void Init(Handle<Object> exports, Handle<Object> module) {
module->Set(String::NewSymbol("exports"),
FunctionTemplate::New(CreateObject)->GetFunction());
}
NODE_MODULE(addon, Init)
```... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
8288d6d0-6eca-57e6-99b9-ba6ccb46349b | docs | nodejs | nodejs_addons | 010x | 8 | Local<Function> fn = tpl->GetFunction();
fn->SetName(String::NewSymbol("theFunction")); // omit this to make it anonymous
return scope.Close(fn);
}
void Init(Handle<Object> exports, Handle<Object> module) {
module->Set(String::NewSymbol("exports"),
FunctionTemplate::New(CreateFunction)->GetFunction());
... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
3d2babde-c495-5eb4-b27d-bdfad3d188e4 | docs | nodejs | nodejs_addons | 010x | 9 | #define MYOBJECT_H
#include <node.h>
class MyObject : public node::ObjectWrap {
public:
static void Init(v8::Handle<v8::Object> exports);
private:
explicit MyObject(double value = 0);
~MyObject();
static v8::Handle<v8::Value> New(const v8::Arguments& args);
static v8::Handle<v8::Value> PlusOne(const v8:... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
ff3b3e75-f095-5813-b363-56c6ab8c8b95 | docs | nodejs | nodejs_addons | 010x | 10 | tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
tpl->PrototypeTemplate()->Set(String::NewSymbol("plusOne"),
FunctionTemplate::New(PlusOne)->GetFunction());
constructor = Persistent<Function>::New(tpl->GetFunction());
exports->Set(String::NewSymbol("MyObject"), constructor);
}
Handle<Val... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
d598bec3-79ee-5fbf-b35f-6027b16a4f8f | docs | nodejs | nodejs_addons | 010x | 11 | return scope.Close(Number::New(obj->value_));
}
```
Test it with:
```None
var addon = require('./build/Release/addon');
var obj = new addon.MyObject(10);
console.log( obj.plusOne() ); // 11
console.log( obj.plusOne() ); // 12
console.log( obj.plusOne() ); // 13
```
### Factory of wrapped objects[#](#addons_factor... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
b8360e8a-8061-5e2a-bf6d-92504c8e78e9 | docs | nodejs | nodejs_addons | 010x | 12 | FunctionTemplate::New(CreateObject)->GetFunction());
}
NODE_MODULE(addon, InitAll)
```
In `myobject.h` we now introduce the static method `NewInstance` that takes
care of instantiating the object (i.e. it does the job of `new` in JavaScript):
```None
#define BUILDING_NODE_EXTENSION
#ifndef MYOBJECT_H
#define M... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
8eba8a0a-2d4e-5412-a0ae-89736a8fe488 | docs | nodejs | nodejs_addons | 010x | 13 | MyObject::MyObject(double value) : value_(value) {
}
MyObject::~MyObject() {
}
void MyObject::Init() {
// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("MyObject"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
114edbd1-ea77-5d34-a60e-fa6508632b6c | docs | nodejs | nodejs_addons | 010x | 14 | return scope.Close(constructor->NewInstance(argc, argv));
}
}
Handle<Value> MyObject::NewInstance(const Arguments& args) {
HandleScope scope;
const unsigned argc = 1;
Handle<Value> argv[argc] = { args[0] };
Local<Object> instance = constructor->NewInstance(argc, argv);
return scope.Close(instance);
}... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
7eabb74c-eee6-56a9-a89e-05d62d833dc4 | docs | nodejs | nodejs_addons | 010x | 15 | ### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around)
In addition to wrapping and returning C++ objects, you can pass them around
by unwrapping them with Node's `node::ObjectWrap::Unwrap` helper function.
In the following `addon.cc` we introduce a function `add()` that can take on two
`MyObject... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
4a5b2b6b-7070-502e-a635-2da750300978 | docs | nodejs | nodejs_addons | 010x | 16 | FunctionTemplate::New(CreateObject)->GetFunction());
exports->Set(String::NewSymbol("add"),
FunctionTemplate::New(Add)->GetFunction());
}
NODE_MODULE(addon, InitAll)
```
To make things interesting we introduce a public method in `myobject.h` so we
can probe private values after unwrapping the object:
... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
e7d4e252-25cf-5743-979e-680feb8b2013 | docs | nodejs | nodejs_addons | 010x | 17 | MyObject::MyObject(double value) : value_(value) {
}
MyObject::~MyObject() {
}
void MyObject::Init() {
// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("MyObject"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
constructor = ... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
49bb6bd7-03df-5d32-b317-4d036ef102e2 | docs | nodejs | nodejs_addons | 010x | 18 | const unsigned argc = 1;
Handle<Value> argv[argc] = { args[0] };
Local<Object> instance = constructor->NewInstance(argc, argv);
return scope.Close(instance);
}
```
Test it with:
```None
var addon = require('./build/Release/addon');
var obj1 = addon.createObject(10);
var obj2 = addon.createObject(20);
var re... | large_dataset/raw/docs/nodejs/addons/addons_010x.md |
c8627aef-bccd-5d7c-9bc6-f0c111fa5622 | docs | nodejs | nodejs_addons | 012x | 0 | # Addons#
Source: https://nodejs.org/docs/latest-v0.12.x/api/addons.html
Version: 0.12.x
Addons are dynamically linked shared objects. They can provide glue to C and
C++ libraries. The API (at the moment) is rather complex, involving
knowledge of several libraries:
* V8 JavaScript, a C++ library. Used for interfacin... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
84d03955-2b62-56c7-85a0-5aac1b02830b | docs | nodejs | nodejs_addons | 012x | 1 | Node statically compiles all its dependencies into the executable.
When compiling your module, you don't need to worry about linking to
any of these libraries.
All of the following examples are available for
[download](https://github.com/rvagg/node-addon-examples) and may be
used as a starting-point for your own Addon... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
b31db6ec-fb18-5012-8cbe-4586283cc9e0 | docs | nodejs | nodejs_addons | 012x | 2 | void Initialize (Handle<Object> exports);
NODE_MODULE(module_name, Initialize)
```
There is no semi-colon after `NODE_MODULE` as it's not a function (see
`node.h`).
The `module_name` needs to match the filename of the final binary (minus the
.node suffix).
The source code needs to be built into `addon.node`, the bin... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
5505d2ef-f0b5-590b-a75e-48b1d0f686f2 | docs | nodejs | nodejs_addons | 012x | 3 | in `build/Release/`.
You can now use the binary addon in a Node project `hello.js` by pointing
`require` to the recently built `hello.node` module:
```None
// hello.js
var addon = require('./build/Release/addon');
console.log(addon.hello()); // 'world'
```
Please see patterns below for further information or
<http... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
c2565bc2-c7d4-5629-b06b-497701af0552 | docs | nodejs | nodejs_addons | 012x | 4 | In cases where there is more than one `.cc` file, simply add the file name to
the `sources` array, e.g.:
```None
"sources": ["addon.cc", "myexample.cc"]
```
Now that you have your `binding.gyp` ready, you can configure and build the
addon:
```None
$ node-gyp configure build
```
### Function arguments[#](#addons_fun... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
b767cda9-51ea-5ca1-8ec2-57ea41ce50c8 | docs | nodejs | nodejs_addons | 012x | 5 | }
double value = args[0]->NumberValue() + args[1]->NumberValue();
Local<Number> num = Number::New(isolate, value);
args.GetReturnValue().Set(num);
}
void Init(Handle<Object> exports) {
NODE_SET_METHOD(exports, "add", Add);
}
NODE_MODULE(addon, Init)
```
You can test it with the following JavaScript snipp... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
d5d016b2-14b7-5efe-9704-1e7689046df5 | docs | nodejs | nodejs_addons | 012x | 6 | void Init(Handle<Object> exports, Handle<Object> module) {
NODE_SET_METHOD(module, "exports", RunCallback);
}
NODE_MODULE(addon, Init)
```
Note that this example uses a two-argument form of `Init()` that receives
the full `module` object as the second argument. This allows the addon
to completely overwrite `exports... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
d31c5032-4713-5b4d-9079-12961e2b7b7e | docs | nodejs | nodejs_addons | 012x | 7 | Local<Object> obj = Object::New(isolate);
obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString());
args.GetReturnValue().Set(obj);
}
void Init(Handle<Object> exports, Handle<Object> module) {
NODE_SET_METHOD(module, "exports", CreateObject);
}
NODE_MODULE(addon, Init)
```
To test it in JavaScript... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
da0d01b4-6882-5fbd-b530-b0d480ce01dc | docs | nodejs | nodejs_addons | 012x | 8 | Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, MyFunction);
Local<Function> fn = tpl->GetFunction();
// omit this to make it anonymous
fn->SetName(String::NewFromUtf8(isolate, "theFunction"));
args.GetReturnValue().Set(... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
18ac4cef-1b24-548a-9c09-7b6230b0d1a9 | docs | nodejs | nodejs_addons | 012x | 9 | Then in `myobject.h` make your wrapper inherit from `node::ObjectWrap`:
```None
// myobject.h
#ifndef MYOBJECT_H
#define MYOBJECT_H
#include <node.h>
#include <node_object_wrap.h>
class MyObject : public node::ObjectWrap {
public:
static void Init(v8::Handle<v8::Object> exports);
private:
explicit MyObject(do... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
db7075e8-0bc1-5852-87f6-1d74e8ebb3d3 | docs | nodejs | nodejs_addons | 012x | 10 | // Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, New);
tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne);
constructor.Reset(isolate, t... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
f895cc28-fdb4-54b6-a083-6938bb801d5b | docs | nodejs | nodejs_addons | 012x | 11 | Local<Function> cons = Local<Function>::New(isolate, constructor);
args.GetReturnValue().Set(cons->NewInstance(argc, argv));
}
}
void MyObject::PlusOne(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
MyObject* obj = ObjectWrap::Unwrap<My... | large_dataset/raw/docs/nodejs/addons/addons_012x.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.