Posts
nginx ingress and SPA sites
Several months ago, I resolved the issue "404 Error on refresh with SPA" by using nginx try_files directive, this time it was quite different as the apps were deployed into kubernetes. I tried nginx.ingress.kubernetes.io/use-regex:true and nginx.ingress.kubernetes.io/rewrite-target: /$1. To avoid to block others to others to use staging environment, I setup an skaffold local development environment to troubeshooting the issue. I tried following annotation as well.
nginx.ingress.kubernetes.io/configuration-snippet: | try_files $uri $uri/ /index.
Posts
vega in hugo
var spec = 'https:\/\/raw.githubusercontent.com\/vega\/vega\/master\/docs\/examples\/bar-chart.vg.json'; vegaEmbed('#viz', spec).then(function(result) { }).catch(console.error);
Posts
echarts in hugo
var myChart = echarts.init(document.getElementById('echarts400')); var option = JSON.parse("\n {\n \"textStyle\":{\n \"color\":\"#fff\"\n },\n \"title\":{\n \"text\":\"2018年11月国内浏览器数据统计\",\n \"subtext\":\"浏览器数据分析\",\n \"x\":\"center\",\n \"textStyle\":{\n \"color\":\"#FFffFf\"\n }\n },\n \"tooltip\":{\n \"trigger\":\"item\",\n \"formatter\":\"{a} \u003cbr/\u003e{b} : {c} ({d}%)\"\n },\n \"legend\":{\n \"type\":\"scroll\",\n \"orient\":\"vertical\",\n \"right\":10,\n \"top\":120,\n \"bottom\":20,\n \"data\":[\n \"Chrome\",\n \"IE 9.0\",\n \"IE 11.0\",\n \"QQ\",\n \"IE 8.0\",\n \"2345\",\n \"搜狗高速\",\n \"Firefox\",\n \"Safari\",\n \"其他\"\n ],\n \"textStyle\":{\n \"color\":\"#fff\"\n }\n },\n \"series\":[\n {\n \"name\":\"浏览器用户比例\",\n \"type\":\"pie\",\n \"radius\":\"55%\",\n \"center\":[\n \"50%\",\n \"60%\"\n ],\n \"data\":[\n {\n \"name\":\"Chrome\",\n \"value\":46.88\n },\n {\n \"
Posts
log to stdin of a pod in nested shells
During practicing the lifecycle handlers of pod, I found it is quite difficult to get the logs logged from preStop handlers. Initially I thought terminationMessagePath maybe is the answer, but no such luck. The preStop handler will be run before the pod is deleted. After deleted, there is no way to get the logs unless those logs are kept in other place such as central log servers etc. Those settings are way complex for a simple practice and time-consuming.
Posts
vscode debug python containers running kubernetes via attachment
python-guestbook at https://github.com/GoogleCloudPlatform/cloud-code-samples is used to practice debug python containers in kubernetes.
Google cloud python code vscode plugin 1.7.0 failed to run python on kubernetes or there is no obvious way to do that as depicted in the below pic. Steps to make it:
run
skaffold debug Import ptvsd in the python file to debug, add breakout() before the line to debug
Posts
Jetbrain debug containers in kubernetes
I can’t debug the dockerdev app following the steps in https://blog.jetbrains.com/go/2020/05/11/using-kubernetes-from-goland/, even after I cloned its source code https://github.com/jackliusr/dockerdev/tree/kubernetes-debug.
I read several articles before I tried the aboved one. The successful debug after several trial and errors. I added skaffold.yaml to the project and installed Cloud Code. skaffold.yaml can be found at https://github.com/jackliusr/dockerdev/tree/kubernetes-debug. Other jetbrain configuration can be seen in the below pictures.
cloud code is a very good tool.
Posts
a new way to anti scrapping
I loved to read novels. Recently I found that several sites show some garbed characters in square boxes. I went to the original site qidian and those chacters are shown correctly in the orignal site. After little investigation, I found the following information;
In above pics, 了’s HTML entity code is , it is not as 天.
How does chrome show the characters correctly?
Posts
Setup kubeflow pipeline on local KIND cluster
# https://www.kubeflow.org/docs/pipelines/installation/localcluster-deployment/#deploying-kubeflow-pipelines # env/platform-agnostic-pns hasn't been publically released, so we install from master temporarily export PIPELINE_VERSION=1.0.1 kubectl apply -k "github.com/kubeflow/pipelines/manifests/kustomize/cluster-scoped-resources?ref=$PIPELINE_VERSION" kubectl wait --for condition=established --timeout=60s crd/applications.app.k8s.io kubectl apply -k "github.com/kubeflow/pipelines/manifests/kustomize/env/platform-agnostic-pns?ref=$PIPELINE_VERSION" # expose gui kubectl port-forward -n kubeflow --address 0.0.0.0 svc/ml-pipeline-ui 8080:80
Posts
Create a multiple-nodes KIND kubernetes cluster
KIND supports configuration items and you can find them at https://kind.sigs.k8s.io/docs/user/configuration. Following is the outline of the doc.
Cluster-Wide Options ︎ Networking: ︎ IP Family ︎ API Server: port and listen address Pod Subnet ︎ Service Subnet ︎ Disable Default CNI: can be used to try other CNI for CKA and CKAD networks kube-proxy mode : iptables, ipvs Nodes: role control-plane, worker Per-Node Options ︎ Extra Mounts ︎ Extra Port Mappings ︎ Kubeadm Config Patches: Kubeadm Config Patches, kubeadm InitConfiguration and JoinConfiguration My asciicast is as following:
Posts
Pod CrashLoopBackOff Reason
Today one of my deployments always got CrashLoopBackOff. Searching internet don’t gave me the root cause of those errors even I went through all the steps. Steps from internets are all about describe, logs, liveProbe etc. I noticed the reason and exit code in last state when I described one of the pod. It should be the focus point to find root cause of CrashBoopBackOff.
Containers: nginx: Container ID: containerd://9570e7e67d83692fdbe0e0871919a81222137fcaee2eaecb1eff6b772ec805b1 Image: nginx:1.