Posts

Showing posts from 2020

Copy directories and files to and from Kubernetes Container [POD]

As we all know about  SCP   Linux command  to Copy the files and directories from a remote host to the local host and vice versa over  SSH . Similar to that we have ' KUBECTL CP ' to Copy the files and directories from a Kubernetes Container [POD] to the local host and vice versa. Syntax : kubectl cp <file-spec-src> <file-spec-dest> POD in a specific container kubectl cp <file-spec-src> <file-spec-dest> -c <specific-container> Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar Copy /tmp/foo from a remote pod to /tmp/bar locally kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar

“docker pull” certificate signed by unknown authority

first create a file -  /etc/docker/daemon.json than run the following to add certs openssl s_client -showcerts -connect <registry_address>:<registry_port> < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/docker/certs.d/<registry_address>/ca.crt works without restart OR import the cert to system like save the cert to the file , like the command above (the port is crucial, no need for the protocol) openssl s_client -showcerts -connect <registry_address>:<registry_port> < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ca.crt copy it to /usr/local/share/ca-certificates/ sudo cp ca.crt /usr/local/share/ca-certificates/ run update-ca-certificates sudo update-ca-certificates restart docker !

kaniko is a tool to build container images from a Dockerfile, inside a container or Kubernetes cluster

kaniko doesn't depend on a Docker daemon and executes each command within a Dockerfile completely in userspace. This enables building container images in environments that can't easily or securely run a Docker daemon, such as a standard Kubernetes cluster. https://github.com/GoogleContainerTools/kaniko#running-kaniko-in-docker

kURL - Open Source Kubernetes Installer online & Airgap

https://kurl.sh/ curl https://kurl.sh/latest | sudo bash

Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.

https://github.com/genuinetools/img img build -t forgegeek/img .

K8s installer offline

Nice project for k8s installation in offline & ansible Docs:- https://k8s-installer.github.io/ https://github.com/k8s-installer/k8s-installer/releases

How to install specific version of Kubernetes?

apt-get install -qy kubeadm=<version> curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \   echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \   sudo apt-get update -q && \   sudo apt-get install -qy kubelet=<version> kubectl=<version> kubeadm=<version> To get list of version kubeadm or kubectl. curl -s https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep Version | awk '{print $2}' Example:- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \   echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \   sudo apt-get update -q && \   sudo apt-get install -qy kubelet=1.9.6-00 kubectl=1.9.6-00 kubeadm=1.9.6-00

How to generate a Dockerfile from an image?

chenzj/dfimage - as described on hub.docker.com regenerates Dockerfile from other images. So you can use it as follows: docker pull chenzj/dfimage  alias dfimage="docker run -v /var/run/docker.sock:/var/run/docker.sock --rm chenzj/dfimage" dfimage IMAGE_ID > Dockerfil

Restore a MongoDB Logical Backup

$ mongorestore --drop --host localhost --port 27017 --user secret --password secret --oplogReplay --gzip --dir /opt/mongodb/backup/testbackup/20160809_1306/test1/dump 2016-08-09T14:23:04.057+0200 building a list of dbs and collections to restore from /opt/mongodb/backup/testbackup/20160809_1306/test1/dump dir 2016-08-09T14:23:04.065+0200 reading metadata for wikipedia.pages from /opt/mongodb/backup/testbackup/20160809_1306/test1/dump/wikipedia/pages.metadata.json.gz 2016-08-09T14:23:04.067+0200 restoring wikipedia.pages from /opt/mongodb/backup/testbackup/20160809_1306/test1/dump/wikipedia/pages.bson.gz 2016-08-09T14:23:07.058+0200 [#######.................] wikipedia.pages 63.9 MB/199.0 MB (32.1%) 2016-08-09T14:23:10.058+0200 [###############.........] wikipedia.pages 127.7 MB/199.0 MB (64.1%) 2016-08-09T14:23:13.060+0200 [###################.....] wikipedia.pages 160.4 MB/199.0 MB (80.6%) 2016-08-09T14:23:16.059+0200 [#######################.] wikipedia...

How do I find my API URL in Salesforce?

The API URL of Salesforce may be different. For example, after the login in the CRM you can use the domain URL:   https://eu6.salesforce.com/ . However, it should look like   https://eu6.salesforce.com/services/data/v31.0/   that means you use the   domain URL   and add   services/data/v31.0/ to it.

Log In Using the SOAP API

The Bulk API doesn't provide a login operation, so you must use SOAP API to log in. Create a text file called  login.txt  containing the following text: 01 <? xml   version = "1.0"   encoding = "utf-8"   ?> 02 < env:Envelope   xmlns:xsd = " http://www.w3.org/2001/XMLSchema " 03      xmlns:xsi = " http://www.w3.org/2001/XMLSchema-instance " 04      xmlns:env = " http://schemas.xmlsoap.org/soap/envelope/ " > 05    < env:Body > 06      < n1:login   xmlns:n1 = "urn: partner.soap.sforce.com " > 07        < n1:username >your_username</ n1:username > 08        < n1:password >your_password</ n1:password > 09      </ n1:login > 10    </ env:Body > 11 </ env:Envelope > Replace  your_username  and  your_password  with your Salesforce user name and password. Using a command-line window, execute the following cURL command: 1 curl  https://login.salesforce.com/services/So...