Created
September 16, 2020 09:11
-
-
Save AkashRajvanshi/bfdd19d1236207542e09c3d3b6fd26bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Installing code-server with persistent storage, because this gives us the freedom to access code files from desired directories | |
| -------------------------------------------------------------------------------------- | |
| # We already create PersistentVolume, but we need a another claim for code-server | |
| # YAML for Persistent Volume Claim ( code-server-pvc.yml ) | |
| --- | |
| apiVersion: v1 | |
| kind: PersistentVolumeClaim | |
| metadata: | |
| name: code-data | |
| spec: | |
| accessModes: | |
| - ReadWriteOnce | |
| resources: | |
| requests: | |
| storage: 3Gi | |
| storageClassName: development | |
| --- | |
| # YAML for code-server container deployment | |
| ---code-server.yml | |
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| labels: | |
| app: code-server | |
| name: code-server | |
| spec: | |
| selector: | |
| matchLabels: | |
| app: code-server | |
| replicas: 3 | |
| template: | |
| metadata: | |
| labels: | |
| app: code-server | |
| spec: | |
| containers: | |
| - image: codercom/code-server:latest | |
| imagePullPolicy: IfNotPresent | |
| name: code-server | |
| env: | |
| - name: PASSWORD | |
| value: "password" | |
| volumeMounts: | |
| - name: data | |
| mountPath: /home/coder/project | |
| volumes: | |
| - name: data | |
| persistentVolumeClaim: | |
| claimName: code-data | |
| --- | |
| -------------------------------------------------------------------------------------- | |
| # Apply Deployments | |
| $ kubectl apply -f ./code-server-pvc.yml | |
| $ kubectl apply -f ./code-server.yml | |
| # Expose to internal network | |
| $ kubectl expose deploy code-server --type=NodePort --port=80 --target-port=8080 | |
| # Access the server on http://10.0.1.86 | |
| # To Scale the deployment | |
| $ kubectl scale deployment code-server --replicas=5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment