Tuesday, November 03, 2020
temporary notes on kind with knative: (not working yet)
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
$ sudo apt update
$ sudo apt install docker-ce
$ sudo usermod -aG docker ${USER}
$ su - ${USER}
$ id -nG
$ curl -OL https://golang.org/dl/go1.15.3.linux-amd64.tar.gz
$ sudo tar -C /usr/local -xzf go1.14.3.linux-amd64.tar.gz
$ export PATH=$PATH:/usr/local/go/bin
$ mkdir -p $HOME/gosrc
$ export GOPATH=$HOME/gosrc
$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
$ sudo apt-get update
$ sudo apt-get install -y kubectl
$ GO111MODULE="on" go get sigs.k8s.io/kind@v0.9.0
$ kind create cluster
$ kubectl apply -f https://github.com/knative/serving/releases/download/v0.18.0/serving-crds.yaml
$ kubectl apply -f https://github.com/knative/serving/releases/download/v0.18.0/serving-core.yaml
$ kubectl apply -f https://github.com/knative/serving/releases/download/v0.18.0/serving-default-domain.yaml
$ kubectl apply -f https://github.com/knative/net-kourier/releases/download/v0.18.0/kourier.yaml
$ kubectl patch configmap/config-network -n knative-serving --type merge -p '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
$ kubectl get configmap kube-proxy -n kube-system -o yaml | sed -e "s/strictARP: false/strictARP: true/" | kubectl apply -f - -n kube-system
$ kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.9.4/manifests/namespace.yaml
$ kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
$ kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.9.4/manifests/metallb.yaml
Thursday, November 05, 2020
the above knative experiment is failed, couldn't route traffic to the loadbalancer
however it's still useful, inside vagrant:
(kind-cluster.yml
)
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5000"]
endpoint = ["http://kind-registry:5000"]
create cluster with $ kind create cluster --config kind-cluster.yml
then create nginx ingress
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
start local registry
$ docker run -d -p 5000:5000 --name kind-registry --restart always -v /vagrant/registry_data:/var/lib/registry registry:2
apply config map
apiVersion: v1
kind: ConfigMap
metadata:
name: local-registry-hosting
namespace: kube-public
data:
localRegistryHosting.v1: |
host: "localhost:5000"
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
then can build and push image to local registry:
$ docker image build -t localhost:5000/nodeapp .
$ docker image push localhost:5000/nodeapp
and start the app
kind: Pod
apiVersion: v1
metadata:
name: nodeapp
labels:
app: nodeapp
spec:
containers:
- name: nodeapp
image: localhost:5000/nodeapp
---
kind: Service
apiVersion: v1
metadata:
name: nodeapp
spec:
selector:
app: nodeapp
ports:
- port: 8080
---
kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
name: nodeapp-ingress
spec:
rules:
- http:
paths:
- path: /nodeapp
backend:
serviceName: nodeapp
servicePort: 8080
then can visit the app within vagrant or on the host as well
Saturday, November 07, 2020
a very useful tool: tomnomnom/gron: Make JSON greppable
a quick read and found something I didn't know: Vi Essentials
Tuesday, November 10, 2020
kind is k8s in a container, k3d is even more lightweight, k3s in a container
the setup is easy, and I'm also no problem with traefik as ingress
but seems local registry is not quite ready on v3
yet, needs to manually mount the config file:
$HOME/.k3d/registries.yaml
:
mirrors:
"registry.localhost:5000":
endpoint:
- "http://registry.localhost:5000"
start the local registry:
$ docker volume create local_registry
$ docker container run -d --name registry.localhost -v local_registry:/var/lib/registry --restart always -p 5000:5000 registry:2
add to /etc/hosts
if registry.localhost
can't be resolved.
start the cluster with (also expose 80
port to host):
$ k3d cluster create -p "80:80@loadbalancer" --volume $HOME/.k3d/registries.yaml:/etc/rancher/k3s/registries.yaml
A tiny CI system built with bash, git and redis
found this while looking for gin articles, looks interesting:
Clean Boilerplate of Go, Domain-Driven Design, Clean Architecture, Gin and GORM
also A quick introduction to clean architecture
Friday, November 13, 2020
picking up shadow-cljs
$ lein new shadow-cljs myapp +reagent
and following ClojureTO/JS-Workshop: Reagent Workshop for React developers
Saturday, November 14, 2020
reading this free book: Fulcro Developers Guide
Sunday, November 22, 2020
some links for practicing numpy and pandas
- A Visual Intro to NumPy and Data Representation
- rougier/numpy-100: 100 numpy exercises
- ajcr/100-pandas-puzzles: 100 data puzzles for pandas
- guipsamora/pandas_exercises: Practice your pandas skills!
Blog Archive
- Newer Entries
- 2020 December
- 2021 January
- 2021 February
- 2021 March
- 2021 April
- 2021 May
- 2021 June
- 2021 August
- 2021 September
- 2021 December
- 2022 March
- 2022 April
- 2022 May
- 2022 June
- 2022 July
- 2022 August
- 2022 September
- 2022 October
- 2022 November
- 2022 December
- 2023 January
- 2023 February
- 2023 March
- 2023 April
- 2023 July
- 2023 August
- 2023 September
- 2023 October
- 2023 November
- 2023 December
- 2024 January
- 2024 February
- 2024 March
- 2024 April
- 2024 May
- 2024 June
- 2024 August
- 2024 September
- Older Entries
- 2020 October
- 2020 September
- 2020 August
- 2019 December
- 2019 November
- 2019 October
- 2019 July
- 2019 May
- 2019 April
- 2019 March
- 2019 February
- 2019 January
- 2018 December
- 2018 November
- 2018 October
- 2018 September
- 2018 August
- 2018 July
- 2018 June
- 2018 May
- 2018 April
- 2018 March
- 2018 February
- 2018 January
- 2017 December
- 2017 November
- 2017 October
- 2017 September
- 2017 August
- 2017 July
- 2017 June
- 2017 May
- 2017 April
- 2017 March
- 2017 February
- 2017 January
- 2016 December
- 2016 November
- 2016 October
- 2016 September
- 2016 August
- 2016 July
- 2016 June
- 2016 May
- 2016 April
- 2016 March
- 2016 February
- 2016 January
- 2015 December
- 2015 November
- 2015 October
- 2015 September
- 2015 August
- 2015 July
- 2015 June
- 2015 May
- 2015 April
- 2015 March
- 2015 February
- 2015 January
- 2014 December
- 2014 November
- 2014 October
- 2014 September
- 2014 August
- 2014 March
- 2014 February
- 2014 January
- 2013 December
- 2013 October
- 2013 July
- 2013 June
- 2013 May
- 2013 March
- 2013 February
- 2013 January
- 2012 December
- 2012 November
- 2012 October
- 2012 September
- 2012 August