Thursday, November 17, 2022

Git: Checkout Specific Folder in a Repository

Reference: https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository

Sparse Checkout is enabled in git 1.7.0

Check out the git version:

# git version

git version 1.8.3.1

Create a folder for the repository:
# mkdir myrepo

Initiate the folder for git

# git init

Disable ssl verify if you are using self-signed certificate:

#  git config http.sslVerify "false"

Fetch all objects from Remote

#  git remote add -f origin https://bitbucket.com/scm/iu/myrepo.git

Enable sparse checkout

#  git config core.sparseCheckout true

Append the subfolder to sparse-checkout

#  echo "tcsfs/helpdesk" >> .git/info/sparse-checkout

Pull your code: 

#  git pull origin master


Monday, October 31, 2022

Docker Client and Containerd Behind Proxy in CentOS 8

# docker pull kubeimage/kube-apiserver:v1.15.0

Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 17.15.75.8:53: no such host

 

vi /usr/lib/systemd/system/docker.service with below entries

[Service]
Environment=HTTP_PROXY=http://8.8.8.8:8888
Environment=HTTPS_PROXY=http://8.8.8.8:8888
systemctl daemon-reload
systemctl restart docker

# kubeadm config images pull --v=10

I1031 22:12:20.527118   22397 version.go:187] fetching Kubernetes version from URL: https://dl.k8s.io/release/stable-1.txt
exit status 1
output: E1031 22:12:20.843791   22419 remote_image.go:242] "PullImage from image service failed" err="rpc error: code = Unknown desc = failed to pull and unpack image \"registry.k8s.io/kube-apiserver:v1.25.3\": failed to resolve reference \"registry.k8s.io/kube-apiserver:v1.25.3\": failed to do request: Head \"https://registry.k8s.io/v2/kube-apiserver/manifests/v1.25.3\": dial tcp: lookup registry.k8s.io on 137.15.210.9:53: no such host" image="registry.k8s.io/kube-apiserver:v1.25.3"
time="2022-10-31T22:12:20-04:00" level=fatal msg="pulling image: rpc error: code = Unknown desc = failed to pull and unpack image \"registry.k8s.io/kube-apiserver:v1.25.3\": failed to resolve reference \"registry.k8s.io/kube-apiserver:v1.25.3\": failed to do request: Head \"https://registry.k8s.io/v2/kube-apiserver/manifests/v1.25.3\": dial tcp: lookup registry.k8s.io on 137.15.210.9:53: no such host"
, error

Add below entries into /usr/lib/systemd/system/containerd.service under section [Service]
[Service]
Environment=HTTP_PROXY=http://8.8.8.8:8888
Environment=HTTPS_PROXY=http://8.8.8.8:8888
systemctl daemon-reload
systemctl restart containerd

Sunday, October 16, 2022

Install Minikube with Docker Engine

Install docker engine

```

yum install -y yum-utils
yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
yum remove docker
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin


Install minikube

https://minikube.sigs.k8s.io/docs/start/

```

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

Install kubectl

https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/

Set environment variables if the minikube runs behind proxy

export HTTP_PROXY=http://<proxy hostname:port>
export HTTPS_PROXY=https://<proxy hostname:port>
export NO_PROXY=localhost,127.0.0.1,192.168.49.0/24

or run below command on fly
```
export no_proxy=$no_proxy,$(minikube ip)

Open firewall rule for port 8443

 ```
firewall-cmd --permanent --add-port=8443/tcp

Start minikube

```
minikube start --driver=docker 


List porfiles
```
minikube profiles list

Delete existing profile
```
minikube delete

Delete existing profile with force
```
minikube delete --purge --all

Get cluster information
```
kubectl cluster-info