Skip to content

Instantly share code, notes, and snippets.

@fatihbaltaci
Last active February 25, 2021 13:38
Show Gist options
  • Save fatihbaltaci/aa01b3ccc7875f7add52b32bb50ffaa9 to your computer and use it in GitHub Desktop.
Save fatihbaltaci/aa01b3ccc7875f7add52b32bb50ffaa9 to your computer and use it in GitHub Desktop.
Kubernetes

Nginx Service and Deployment

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-ui
spec:
  selector:
    matchLabels:
      app: nginx-ui
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx-ui
    spec:
      containers:
      - name: nginx-ui
        image: nginx
        env:
          - name: TZ
            value: "Turkey"
        imagePullPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-ui
spec:
  ports:
  - name: http
    port: 80
    nodePort: 32014
  selector:
    app: nginx-ui
  type: NodePort

Run curl <kubernetes_master_ip>:32014

MicroK8s

Install

  • Get Latest
sudo snap install microk8s --classic
  • Get Specific Version

Compatible kubeflow version: Link

sudo snap install microk8s --classic --channel=1.14/stable
  • Continue
sudo usermod -a -G microk8s fatihbaltaci
microk8s.status --wait-ready
microk8s.enable dns storage dashboard
sudo snap alias microk8s.kubectl kubectl
microk8s.kubectl config view --raw > $HOME/.kube/config

If you have a GPU, run:

microk8s.enable gpu

Uninstall

microk8s.reset
sudo snap remove microk8s

Kubeflow

Install Command Line Tools KFCTL

wget -O kfctl.tar.gz https://github.com/kubeflow/kubeflow/releases/download/v1.0/kfctl_v1.0-0-g94c35cf_linux.tar.gz
tar xzvf kfctl.tar.gz
chmod +x ./kfctl
sudo mv ./kfctl /usr/local/bin/kfctl

Install Kubeflow

export KF_NAME=kubeflow
export BASE_DIR=/home/fatihbaltaci
export KF_DIR=${BASE_DIR}/${KF_NAME}
export CONFIG_URI="https://raw.githubusercontent.com/kubeflow/manifests/v1.0-branch/kfdef/kfctl_k8s_istio.v1.0.0.yaml"

mkdir -p ${KF_DIR}
cd ${KF_DIR}
sudo kfctl apply -V -f ${CONFIG_URI}

# Check install status
watch -c -n 10 kubectl -n kubeflow get po

Access Kubeflow

  • Get Node port (default is 31380):
echo `kubectl get svc -n istio-system istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment