# 导入 yaml 文件
URL: /%E6%96%87%E6%A1%A3/04.%E5%BC%80%E5%8F%91%E6%96%87%E6%A1%A3/03.%20%E8%BF%90%E7%BB%B4%E6%89%8B%E5%86%8C/02.%20K8S%E8%BF%90%E7%BB%B4/10.%20K8S%20%E5%B8%B8%E7%94%A8%E7%BB%84%E4%BB%B6/06.%20Node%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83-JAVA


# 导入 yaml 文件

注意调整 namespace

```yaml
### 
# 批量替换 namespace: scrm
###
# ServiceAccount
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: tailscale
  namespace: scrm

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: tailscale
  namespace: scrm
subjects:
- kind: ServiceAccount
  name: tailscale
roleRef:
  kind: Role
  name: tailscale
  apiGroup: rbac.authorization.k8s.io
  
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: tailscale
  namespace: scrm
rules:
- apiGroups: [""] # "" indicates the core API group
  resources: ["secrets"]
  # Create can not be restricted to a resource name.
  verbs: ["create"]
- apiGroups: [""] # "" indicates the core API group
  resourceNames: ["tailscale-auth"]
  resources: ["secrets"]
  verbs: ["get", "update", "patch"]

# 部署
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    k8s.kuboard.cn/displayName: tailscale
  labels:
    k8s.kuboard.cn/layer: web
    k8s.kuboard.cn/name: dev-tail
  name: dev-tail
  namespace: scrm
  resourceVersion: '20737565389'
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      k8s.kuboard.cn/layer: web
      k8s.kuboard.cn/name: dev-tail
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/restartedAt: '2024-05-06T00:06:49+08:00'
      creationTimestamp: null
      labels:
        k8s.kuboard.cn/layer: web
        k8s.kuboard.cn/name: dev-tail
    spec:
      containers:
        - env:
            - name: TS_AUTHKEY
              value: tskey-auth-kTwQRqR7yu11CNTRL-vo3dDsb8ZESs5F58XjJiAS22V6x8tkcVc
            - name: TS_USERSPACE
              value: 'false'
            - name: TS_KUBE_SECRET
              value: tailscale-auth
            - name: TS_HOSTNAME
              value: aoxmed-tail
            - name: TS_EXTRA_ARGS
              value: '--ssh'
          image: 'registry-vpc.cn-shanghai.aliyuncs.com/base-widiazine/base:tailscale_2.0'
          imagePullPolicy: Always
          name: ts-sidecar
          resources:
            limits:
              cpu: '2'
              memory: 4Gi
            requests:
              cpu: 100m
              memory: 256Mi
          securityContext:
            capabilities:
              add:
                - NET_ADMIN
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /root
              name: volume-sj42e
              subPath: idea
        - image: 'registry-vpc.cn-shanghai.aliyuncs.com/base-widiazine/base:vscode'
          imagePullPolicy: IfNotPresent
          name: vscode
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
        - name: aliyun
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: tailscale
      serviceAccountName: tailscale
      terminationGracePeriodSeconds: 30
      volumes:
        - name: volume-sj42e
          persistentVolumeClaim:
            claimName: idea-data

# 存储挂载
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    k8s.kuboard.cn/pvcType: Dynamic
    pv.kubernetes.io/bind-completed: 'yes'
    pv.kubernetes.io/bound-by-controller: 'yes'
  finalizers:
    - kubernetes.io/pvc-protection
  name: idea-data
  namespace: scrm
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 20Gi
  storageClassName: default # 存储类型

```

## 进入容器

创建 GIT 目录

`cd /root/GIT/`

git 拉取

`git clone https://xxx`

输入一次，以后记住

```shell
git config --global credential.helper store
```

## 打开 gateway，准备创建

注意调整 Maven 配置文件

注意下载 JDK
