karmada hack/local-up-karmada.sh

 存在k8s集群

删除env CLUSTER_IP_ONLY=true hack/remote-up-karmada.sh ~/.kube/config kubernetes-admin@kubernetes 产生的karmada 控制面

kubectl delete -f  karmada-etcd.yaml 
kubectl delete -f  karmada-apiserver.yaml
kubectl delete -f karmada-scheduler.yaml
kubectl delete -f  controller-manager.yaml 
kubectl delete -f  karmada-webhook.yaml
kubectl delete -f  kube-controller-manager.yaml
kubectl delete svc karmada-apiserver  -n karmada-system

 

 env REGISTRY="ubuntu:5000" hack/local-up-karmada.sh

root@cloud:~/karmada# source ~/hyper/go_source
root@cloud:~/karmada# hack/local-up-karmada.sh
Installing ‘kind v0.11.1‘ for you, may require the root privileges
200
/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/opt/gopath/bin
Creating cluster karmada-host
make: Entering directory ‘/root/karmada‘
VERSION=latest hack/docker.sh karmada-controller-manager
Sending build context to Docker daemon 631.1MB
Step 1/4 : FROM alpine:3.7
3.7: Pulling from library/alpine
40223db5366f: Pull complete
Digest: sha256:8421d9a84432575381bfabd248f1eb56f3aa21d9d7cd2511583c68c9b7511d10
Status: Downloaded newer image for alpine:3.7
---> bd812700d284
Step 2/4 : RUN apk add --no-cache ca-certificates
---> Running in c2b7b8444b91
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/aarch64/APKINDEX.tar.gz
(1/1) Installing ca-certificates (20190108-r0)
Executing busybox-1.27.2-r11.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 5 MiB in 14 packages
Removing intermediate container c2b7b8444b91
---> 8d4b967f0747
Step 3/4 : ADD karmada-controller-manager /bin/
---> f55783c3bbf8
Step 4/4 : CMD ["/bin/karmada-controller-manager"]
---> Running in 4a9463ffb6e5
Removing intermediate container 4a9463ffb6e5
---> 55ed78955027
Successfully built 55ed78955027
Successfully tagged swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-controller-manager:latest
VERSION=latest hack/docker.sh karmada-scheduler
Sending build context to Docker daemon 631.1MB
Step 1/4 : FROM alpine:3.7
---> bd812700d284
Step 2/4 : RUN apk add --no-cache ca-certificates
---> Using cache
---> 8d4b967f0747
Step 3/4 : ADD karmada-scheduler /bin/
---> 3ddbe9dd070d
Step 4/4 : CMD ["/bin/karmada-scheduler"]
---> Running in 01fd3ed75548
Removing intermediate container 01fd3ed75548
---> 0abf122fc598
Successfully built 0abf122fc598
Successfully tagged swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:latest
CGO_ENABLED=0 GOOS=linux go build \
-ldflags "-X github.com/karmada-io/karmada/pkg/version.gitVersion=v0.7.0-111-g8effddd-dirty -X github.com/karmada-io/karmada/pkg/version.gitCommit=8effddd3bb71cd2669e16adbb642e4099b2f6a97 -X github.com/karmada-io/karmada/pkg/version.gitTreeState="dirty" -X github.com/karmada-io/karmada/pkg/version.buildDate=2021-08-17T10:58:30Z" \
-o karmada-webhook \
cmd/webhook/main.go
VERSION=latest hack/docker.sh karmada-webhook
Sending build context to Docker daemon 631MB
Step 1/4 : FROM alpine:3.7
---> bd812700d284
Step 2/4 : RUN apk add --no-cache ca-certificates
---> Using cache
---> 8d4b967f0747
Step 3/4 : ADD karmada-webhook /bin/
---> 77b901d63349
Step 4/4 : CMD ["/bin/karmada-webhook"]
---> Running in 79c5e9b50eac
Removing intermediate container 79c5e9b50eac
---> 843f79ab7b75
Successfully built 843f79ab7b75
Successfully tagged swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-webhook:latest
CGO_ENABLED=0 GOOS=linux go build \
-ldflags "-X github.com/karmada-io/karmada/pkg/version.gitVersion=v0.7.0-111-g8effddd-dirty -X github.com/karmada-io/karmada/pkg/version.gitCommit=8effddd3bb71cd2669e16adbb642e4099b2f6a97 -X github.com/karmada-io/karmada/pkg/version.gitTreeState="dirty" -X github.com/karmada-io/karmada/pkg/version.buildDate=2021-08-17T10:58:30Z" \
-o karmada-agent \
cmd/agent/main.go
VERSION=latest hack/docker.sh karmada-agent
Sending build context to Docker daemon 630.9MB
Step 1/4 : FROM alpine:3.7
---> bd812700d284
Step 2/4 : RUN apk add --no-cache ca-certificates
---> Using cache
---> 8d4b967f0747
Step 3/4 : ADD karmada-agent /bin/
---> 8c2510209999
Step 4/4 : CMD ["/bin/karmada-agent"]
---> Running in 77110996fc6b
Removing intermediate container 77110996fc6b
---> ab20065c6915
Successfully built ab20065c6915
Successfully tagged swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-agent:latest
make: Leaving directory ‘/root/karmada‘
Waiting for the host clusters to be ready... it may take a long time for pulling the kind image
Waiting for kubeconfig file /root/.kube/karmada.config and clusters karmada-host to be ready...
root@cloud:~/karmada#

 

root@cloud:~/karmada# docker images | grep kind
kindest/node                                                                  v1.19.1               37ddbc9063d2        11 months ago       1.33GB
root@cloud:~/karmada# docker images | grep kind
kindest/node                                                                  v1.19.1               37ddbc9063d2        11 months ago       1.33GB
root@cloud:~/karmada# 

 

 

root@cloud:~/karmada/hack# kind version
kind v0.11.1 go1.16.4 linux/arm64
root@cloud:~/karmada/hack# 

 

root@cloud:~/karmada# kind get  cluster
ERROR: unknown command "cluster" for "kind get"
root@cloud:~/karmada# kind create cluster
Creating cluster "kind" ...
 ? Ensuring node image (kindest/node:v1.21.1) 

 ? Preparing nodes   
 ? Writing configuration 

 ? Starting control-plane ? 
 ? Installing CNI 

 ? Installing StorageClass 

                            Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a nice day! 

                  root@cloud:~/karmada# kind get  cluster
ERROR: unknown command "cluster" for "kind get"
root@cloud:~/karmada# kubectl get cluster
error: the server doesnt have a resource type "cluster"
root@cloud:~/karmada# 

 

root@cloud:~/karmada# kubectl get cluster
error: the server doesnt have a resource type "cluster"
root@cloud:~/karmada# kind get clusters
kind
root@cloud:~/karmada# kubectl config get-contexts
CURRENT   NAME                          CLUSTER      AUTHINFO           NAMESPACE
*         kind-kind                     kind-kind    kind-kind          
          kubernetes-admin@kubernetes   kubernetes   kubernetes-admin   
root@cloud:~/karmada# kubectl get nodes
NAME                 STATUS   ROLES                  AGE     VERSION
kind-control-plane   Ready    control-plane,master   2m34s   v1.21.1
root@cloud:~/karmada# kubectl config set-context kubernetes-admin@kubernetes
Context "kubernetes-admin@kubernetes" modified.
root@cloud:~/karmada# kubectl get nodes
NAME                 STATUS   ROLES                  AGE     VERSION
kind-control-plane   Ready    control-plane,master   3m45s   v1.21.1
root@cloud:~/karmada# kind delete cluster --name kind
Deleting cluster "kind" ...
root@cloud:~/karmada# kubectl get nodes
error: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
root@cloud:~/karmada# 

 

 

root@cloud:~/karmada# ls ~/.kube/
cache  config  http-cache
root@cloud:~/karmada# ls ~/.kube/config 
/root/.kube/config

 

root@cloud:~/karmada# kubectl config use-context kubernetes-admin@kubernetes
Switched to context "kubernetes-admin@kubernetes".
root@cloud:~/karmada# kubectl get nodes
NAME      STATUS   ROLES    AGE   VERSION
bogon     Ready    <none>   47d   v1.18.1
centos7   Ready    master   47d   v1.18.1
cloud     Ready    master   47d   v1.21.1
ubuntu    Ready    master   47d   v1.18.1
root@cloud:~/karmada# 

 

karmada hack/local-up-karmada.sh

上一篇:网络安全系列之二十二 Windows用户账号加固


下一篇:C# redis简单的使用