Wednesday, August 21, 2019

[Kubernetes] Call Kubernetes APIs

If you want to use Bash Shell  to call Kubernetes APIs, Here is the way to get the token and use it as follows:

Prepare variables
#APISERVER="https://10.10.0.100:6443"
$ APISERVER=$(kubectl config view | grep server | cut -f 2- -d ":" | tr -d " ")
$ TOKEN=$(kubectl describe secret $(kubectl get secrets | grep default | cut -f1 -d ' ') | \
    grep -E '^token' | cut -f2 -d':' | tr -d '\t')
Call APIs
$ curl $APISERVER/api --header "Authorization: Bearer ${TOKEN//[[:space:]]/}" --insecure
{
  "kind": "APIVersions",
  "versions": [
    "v1"
  ],
  "serverAddressByClientCIDRs": [
    {
      "clientCIDR": "0.0.0.0/0",
      "serverAddress": "192.168.0.100:6443"
    }
  ]
}

[Docker] Troubleshooting to docker private registry

I create a private docker registry as follows and sometimes it cannot reply the http request.
$ sudo docker run -p 7443:7443 --restart=always \
  -v /raid/registry2:/var/lib/registry \
  -e REGISTRY_HTTP_ADDR=0.0.0.0:7443 \
  --name registry registry:2

$ curl -v http://192.168.10.10:7443/v2/_catalog
*   Trying 192.168.10.10...
* TCP_NODELAY set
* Connected to 192.168.10.10 (192.168.10.10) port 7443 (#0)
> GET /v2/_catalog HTTP/1.1
> Host: 192.168.0.109:7443
> User-Agent: curl/7.58.0
> Accept: */*
...(hang)...

Tuesday, August 20, 2019

[Kubernetes] Add new DNS server in CoreDNS Configuration

After finished the K8S installation, I had encountered an issue that the pod cannot resolve the domain name. I use these commands to check the DNS issue.
$ systemd-resolve --status
nameservers:
                  addresses:
                  - 210.240.232.1
                  search: []

# use busybox pod to run nslookup
$ kubectl apply -f https://k8s.io/examples/admin/dns/busybox.yaml
$ kubectl exec -it busybox -- nslookup kubernetes.default
$ kubectl exec -it busybox -- nslookup google.com

# check local DNS configuration
$ kubectl exec busybox cat /etc/resolv.conf

Monday, August 5, 2019

[Qt] How to install Qt for WebAssembly

In the previous post: [Qt] The Qt features of WebAssembly and Qt quick WebGLStreaming, I mentioned about Qt for WebAssembly but didn't try it yet. Here, this post is to introduce how to install Qt for WebAssembly and give an example to try by the following steps: