Skip to content

Instantly share code, notes, and snippets.

View ycliu912's full-sized avatar

Alex liu ycliu912

View GitHub Profile
@ycliu912
ycliu912 / README.md
Created May 21, 2020 07:41 — forked from chuyik/README.md
macOS 给 Git(Github) 设置代理(HTTP/SSH)
@ycliu912
ycliu912 / k8s-create-deployment.go
Last active September 13, 2019 05:16 — forked from ffledgling/k8s-create-deployment.go
kubernetes client-go example: Create a Deployment based on json
package main
/*
k8s-create-deployment.go
https://gist.github.com/ffledgling/62814ccbb12fd6b9ab6fd89da7e80cd2
*/
import (
"encoding/json"
"log"
package main
import (
"flag"
"fmt"
"time"
"k8s.io/klog"
"k8s.io/api/core/v1"
@ycliu912
ycliu912 / tasks.json
Created September 9, 2019 02:48
vscode-tasks.json
// See http://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
// ${workspaceRoot} the path of the folder opened in VS Code
// ${file} the current opened file
// ${fileBasename} the current opened file's basename
// ${fileDirname} the current opened file's dirname
// ${fileExtname} the current opened file's extension
// ${cwd} the task runner's current working directory on startup
{
"version": "0.1.0",
@ycliu912
ycliu912 / tasks.json
Created September 6, 2019 16:20 — forked from mattmc3/tasks.json
VSCode tasks for Golang
// See http://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
// ${workspaceRoot} the path of the folder opened in VS Code
// ${file} the current opened file
// ${fileBasename} the current opened file's basename
// ${fileDirname} the current opened file's dirname
// ${fileExtname} the current opened file's extension
// ${cwd} the task runner's current working directory on startup
{
"version": "0.1.0",
@ycliu912
ycliu912 / kubeconfig
Last active July 9, 2019 09:07
kubeconfig
apiVersion: v1
clusters:
- cluster:
server: http://apiserver.marathon.slave.l4lb.thisdcos.directory:31080
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes
@ycliu912
ycliu912 / Upgrade vim
Created July 5, 2019 18:47 — forked from yevrah/Upgrade vim
Update to Vim8 on Centos 7
################################################################################
# Method 1: Install using rpm packages (credit to DarkMukke)
#
rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7
# WARNING: removing vim-minimal uninstalls `sudo` if you skip the second step
# make sure to at least run `yum install sudo`
yum -y remove vim-minimal vim-common vim-enhanced

Mesos-DNS 部署

Mesos-dns是 mesos 服务发现工具,能查找app的Ip,端口号以及master,leader等信息。在Apache Mesos 集群中,允许应用程序和服务通过域名系统(DNS)来相互定位。Mesos-DNS 的特点是轻量、无状态,易于部署和维护。Mesos-DNS 将每个集群中正在运行的应用程序的域名转换成IP 地址和端口号。这使得任何链接到集群中运行的服务都可以通过DNS 进行查找。 Mesos-DNS是简单和无状态的,它不需要一致性机制,持久存储或日志复制,因为应用所需的心跳,健康监控或生命周期管理等功能都已经由Master、Agent和框架所提供。Mesos-DNS可以通过使用像Marathon这样的框架来实现容错,可以监控应用程序运行状况并在应用出现故障时重新启动它。Mesos-DNS因故障重新启动时,无需进一步协调它会从Master节点检索最新的应用状态,然后处理DNS请求。可以通过增加Master节点,即可提高可用性并为大规模集群中的DNS请求提供负载均衡。

Mesos-DNS 安装

Mesos-DNS 可以装在Mesos集群的任意一台机器上,或者是在同一网络的一台专用机器上。为了实现HA,可以在多个master上分别部署mesos-dns 实例。

wget https://github.com/mesosphere/mesos-dns/releases/download/v0.6.0/mesos-dns-v0.6.0-linux-amd64
sudo mv mesos-dns-v0.6.0-linux-amd64 /usr/local/bin/
@ycliu912
ycliu912 / ss-redir 透明代理.md
Created January 15, 2018 03:16 — forked from wen-long/ss-redir 透明代理.md
ss-redir 透明代理.md

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个