Getting Started Stable Diffusion with LoRA models
1. About Stable Diffusion
Follow an official article for this document when the version of Kubernetes was 1.26 and set up VMs on GCP.
https://devopscube.com/setup-kubernetes-cluster-kubeadm/
In this document, the next kubernetes cluster will be set up:
graph TB
subgraph cluster [cluster in GCP]
subgraph controlPlane [Control plane nodes]
subgraph controlPlaneSystemd [Systemd]
controlPlaneNodeKubelet[kubelet]
controlPlaneNodeContainerd[containerd]
end
end
end
Set up 3 GCE instances using the instance template, instance group without autoscaling:
gcloud compute instance-templates create test-k8s-node-template --machine-type=e2-standard-4 --network-interface=network=default,network-tier=PREMIUM --maintenance-policy=MIGRATE --provisioning-model=STANDARD --scopes=https://www.googleapis.com/auth/cloud-platform --create-disk=auto-delete=yes,boot=yes,device-name=test-k8s-node-template,image=projects/debian-cloud/global/images/debian-11-bullseye-v20221206,mode=rw,size=10,type=pd-balanced --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any
gcloud beta compute instance-groups managed create test-k8s-nodes --base-instance-name=test-k8s-nodes --size=3 --template=test-k8s-node-template --zone=us-central1-a --list-managed-instances-results=PAGELESS
gcloud beta compute instance-groups managed set-autoscaling test-k8s-nodes --project=$PROJECT --zone=us-central1-a --cool-down-period=60 --max-num-replicas=3 --min-num-replicas=3 --mode=off --target-cpu-utilization=1.0
See this page for what ports are required to be opened.
Use netcat to check ports
sudo apt update && sudo apt -y install netcat
Use iptables to open a port
sudo iptables -I INPUT 1 -i eth0 -p tcp --dport 6443 -j ACCEPT
sudo iptables -I INPUT 1 -i eth0 -p tcp --dport 2379 -j ACCEPT
sudo iptables -I INPUT 1 -i eth0 -p tcp --dport 2380 -j ACCEPT
sudo /sbin/iptables-save > iptables.v4
sudo iptables-restore < iptables.v4
Follow this document to set up container runtimes on the node.
Enable overlay and br_netfilter kernel modules.
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
sudo /usr/sbin/modprobe overlay
sudo /usr/sbin/modprobe br_netfilter
# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
# Apply sysctl params without reboot
sudo sysctl --system
Verify the modules are loaded and running by:
lsmod | grep br_netfilter
lsmod | grep overlay
Verify configurations are set correctly by
sudo sysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward
Install a container runtime by following another article.
Confirm the version of loopback CNI plugin is greater than v1.0
/opt/cni/bin/loopback --version
CNI loopback plugin v1.1.1
Generate the default container.toml
configuration
sudo mkdir /etc/containerd
sudo bash -c "containerd config default > /etc/containerd/container.toml"
Then edit the container.toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
...
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
- SystemdCgroup = false
+. SystemdCgroup = true
Restart a containerd
sudo systemctl restart containerd
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Note that install kubelet 1.25 instead of 1.26 because I got an error described in this article.
At first, just trying to use kubeadm
sudo kubeadm init --pod-network-cidr 10.88.0.0/16
If it fails to init a k8s cluster, then fix an issue, revert a configuration by kubeadm reset
and restart the init command again.
Then enable kubectl works for a non-root user by
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Kubernetes requires to set up a networking model. In this article, try to install a cilimn.
At first, install a cilium CLI.
CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
CLI_ARCH=amd64
if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
Then start a cilium
.
cilium install
Then it’s possible to see a configuration on Cilim.
sudo cat /etc/cni/net.d/05-cilium.conf
{
"cniVersion": "0.3.1",
"name": "cilium",
"type": "cilium-cni",
"enable-debug": false,
"log-file": "/var/run/cilium/cilium-cni.log"
}
There are 2 types of cgroup drivers
systemd
is used as the init system, then this should be used because systemd expects a single cgroup manager.Note that systemd is recommended because kubeadm manages the kubelet as a systemd service.
To confirm if a cgroup driver is systemd, run
kubectl get cm kubelet-config -n kube-system -o yaml | grep cgroupDriver
After setting up a control plane node, confirm a node and pods start working correctly.
If it’s working correctly, the status of node should be Ready and
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
test-k8s-nodes-cxgs Ready control-plane 3m21s v1.25.5
To run kubeadm, set up a few things beforehand
At first, create a DNS for control plane nodes on Cloud DNS.
gcloud dns managed-zones create at-ishikawa-dev --dns-name="at-ishikawa.dev." --visibility="private" --networks="default" --description="The DNS for test-k8s-nodes"
gcloud dns record-sets create k8s-control-plane.at-ishikawa.dev. --zone="at-ishikawa-dev" --type="A" --ttl="300" --rrdatas="10.128.15.225"
Check your subnet CIDR on GCP
> gcloud compute networks subnets list | grep us-central
default us-central1 default 10.128.0.0/20 IPV4_ONLY
sudo kubeadm init --control-plane-endpoint k8s-control-plane.at-ishikawa.dev \
--pod-network-cidr 10.88.0.0/16
The node didn’t become ready due to an error.
Ready False Sat, 24 Dec 2022 05:34:14 +0000 Sat, 24 Dec 2022 05:34:08 +0000 KubeletNotReady container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized
In my case, I just didn’t install a CNI plugin of containerd and there was no file under /etc/cni/net.d
kubectl describe pods -n kube-system coredns-787d4945fb-qdl42
Warning FailedCreatePodSandBox 7s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "ff4f7fd11035c73bfe145563ad312e423d2dee5c86eb2db288e1dc261bf84e53": failed to find plugin "loopback" in path [/usr/lib/cni]
The loopback version of containerd must be v1.0.0, but it wasn’t when I installed containerd
by apt update && apt install containerd
.
/opt/cni/bin/loopback --help
CNI loopback plugin v0.8.6
Instead of installing it by apt
, install containerd
and CNI plugins from binaries, following these steps.
1. About Stable Diffusion
Basic commands
Template package
This article was written by just following Kelsey Hightower’s Kubernetes Hardway document to understand Kubernetes internal architecture.
There are a few documents to manage billing data in BigQuery Attribution of committed use discount fees and credits How to export to BigQuery Structur...
Operations
Architecture
Following videos are helpful to understand the overview of Elasticsearch more.
In this post, some variables defined in Grafana are used for Prometheus metrics, including $__rate_interval: This article describes the benefit of this va...
Follow this document mainly.
There are an awesome article about the options to use the Google Secret Manager and their pros and cons. In this article, use Secrets Store CSI Driver by fol...
To figure out which kubernetes objects are how much resource, a vertical pod autoscaler might be useful. It has a feature to either automatically update valu...
This document is written by following this document.
Basically, follow this document
There is a good video to describe a algorithms of TiDB:
TiDB data is split into multiple nodes and they’re called the name as a region.
Install go install cuelang.org/go/cmd/cue@latest
This document just follows a quick tutorial for kubebuilder and learn its behavior.
There are multiple documents about innodb locks on MySQL 5.7: InnoDB locking Locks Set by Different SQL Statements in InnoDB Using InnoDB Transaction ...
I used to use Windows 11, but for some reasons, the OS stopped working and I needed to clean-install it from Windows 10 from windows recovery environment.
See another post also to set up a TiDB on minikube.
Overview
Follow an official article for this document when the version of Kubernetes was 1.26 and set up VMs on GCP.
SSH configuration
SSH configuration
The official document: Docker image and initial configuration
There are fewer lock contentions to worry about, replication is a lot happier, production impact of outages become smaller, backups and restores run faster, ...
Getting Started Use minikube by following this document
In this article, explain how to backup MySQL database using Percona Xtrabackup. There are two binaries, innobackupex and xtrabackup. innobackupex is a wrappe...
Set up TypeScript Next.js with Material UI
Basic configuration
Orchestrator is a tool for MySQL HA and replication management.
Consul is developed by Hashicorp to provide a few features like a service discovery.
This configuration is for the version 5.7 and it’s minimum configuration in the official document.
gh-ost
I set up Ubuntu for the 1st time since several years ago.
Apache Cassandra
Getting started
jq is used to parse JSON result, format and output on the cli.
MySQL connections
This is written on March 2021.
I mostly followed this article to update a WSL version, except that I didn’t enable Hyper-V until then and got an error Please enable the Virtual Machine Pla...
There are many web sites to compare static site generator, but they miss some explanations that require to me. For some people, these features are important ...
PHPBench framework
Command list
The deployment is many use cases and in this page, they’re not described. For the details for those use cases or the concept of deployment, see official page.
Configurations
This document is written for MySQL 5.7, so these contents may be not correct for other versions.
This document is written for MySQL 5.7, so these contents may be not correct for other versions. In this page, performance_schema is mainly discussed.
Configurations
There are some cases that we wanna fetch all records that are matching with a certain condition from an other gRPC server. In these cases, there are at least...
Written in March, 2020.
Functions
The configuration to enable comments is described in the official page.
Getting Started See Official tutorial for detail steps.
Configuration The detail for gitconfig is written in official page.
Written in March 2020.
This page explains how to enable searching non-posts pages for Minimal mistakes by Lunr.js for someone who does not know jekyll at all. Lunr.js is the defaul...
This document is described based on MySQL 5.6.
Performance
MySQL Tuner tool This is a tool to review a configuration for MySQL server.
Collect recent error logs If the logs are outputted by zap, error messages are aggregated by checking level = error. This log does not work very well if the ...
The Cloud endpoint is actually the NGINX proxy which offers the following features on GCP. Authentication and validation Logging and monitoring in GCP
http package in golang supports HTTP/2 protocols. It’s automatically configured.
Basic concepts There are some basic components for terraform.
Troubleshootings
gogo/protobuf is the library to store some extensions from golang/protobuf in this repository. There are some useful packages that golang/protobuf does not p...
Target upstream services Cloud CDN can have only GCP load balancer as the upstream services. And GCP load balancer can configure one of followings for backen...
Some JavaScript library depends on Google Closure. If you need to understand the behavior of such a library, you have to know closure. The official document ...