Resources

Summary

# Terminal
sudo snap install microk8s --classic
microk8s.status
microk8s.enable dns ingress dashboard
microk8s.config
microk8s.kubectl cluster-info
microk8s.kubectl create namespace coder-env
microk8s.kubectl delete namespace coder-env
sudo snap alias microk8s.kubectl kubectl
kubectl apply -f coder.yml

# coder.yml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: coder
  name: coder-deployment
  namespace: coder-env
spec:
  replicas: 1
  selector:
    matchLabels:
      app: coder
  template:
    metadata:
      labels:
        app: coder
    spec:
      containers:
      - image: codercom/code-server
        volumeMounts:
        - mountPath: /code
          name: code
        command: ["code-server", "--allow-http", "--no-auth"]
        name: coder
        ports:
        - containerPort: 8443
        livenessProbe:
          httpGet:
            path: /
            port: 8443
          initialDelaySeconds: 5
          timeoutSeconds: 30
      volumes:
      - hostPath:
          path: /home/kobaltz/code
        name: code
---
apiVersion: v1
kind: Service
metadata:
  name: coder-service
  namespace: coder-env
  labels:
    app: coder
spec:
  ports:
    - port: 80
      protocol: TCP
      targetPort: 8443
  selector:
    app: coder
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: coder-ingress
  namespace: coder-env
spec:
  rules:
    - host: coder.192.168.2.190.xip.io
      http:
        paths:
          - path: /
            backend:
              serviceName: coder-service
              servicePort: 80