| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # Note - an NFS server isn't really a Kubernetes concept. |
| # We're just creating it in Kubernetes for illustration and convenience. |
| # In practice it might be run in some other system. |
| # Note that this does not work on docker desktop due to kernel limitations. |
| |
| # Create a service to expose the NFS server |
| # to pods inside the cluster. |
| kind: Service |
| apiVersion: v1 |
| metadata: |
| name: nfs-server |
| spec: |
| selector: |
| role: nfs |
| ports: |
| # Open the ports required by the NFS server |
| # Port 2049 for TCP |
| - name: tcp-2049 |
| port: 2049 |
| protocol: TCP |
| # Port 111 for UDP |
| - name: udp-111 |
| port: 111 |
| protocol: UDP |
| |
| --- |
| |
| # Run the NFS server image in a pod that is |
| # exposed by the service. |
| kind: Pod |
| apiVersion: v1 |
| metadata: |
| name: nfs-server-pod |
| labels: |
| role: nfs |
| spec: |
| containers: |
| - name: nfs-server-container |
| image: cpuguy83/nfs-server |
| securityContext: |
| privileged: true |
| args: |
| # Pass the paths to share to the Docker image |
| - /exports |