一 yaml
k8s和minikube的暴露服务是不同的
k8s 用 Nodeport
minikube 用 LoadBalancer + minikube tunnel
二 minikube
1 hbase.yaml
---
apiVersion: v1
kind: Service
metadata:
name: hbase-cluster
spec:
type: LoadBalancer
selector:
app: hbase
ports:
-
name: port-2181
protocol: TCP
port: 2181
targetPort: 2181
-
name: port-8080
protocol: TCP
port: 8080
targetPort: 8080
-
name: port-8085
protocol: TCP
port: 8085
targetPort: 8085
-
name: port-9000
protocol: TCP
port: 9000
targetPort: 9000
-
name: port-9090
protocol: TCP
port: 9090
targetPort: 9090
-
name: port-16000
protocol: TCP
port: 16000
targetPort: 16000
-
name: port-16010
protocol: TCP
port: 16010
targetPort: 16010
-
name: port-16020
protocol: TCP
port: 16020
targetPort: 16020
-
name: port-16201
protocol: TCP
port: 16201
targetPort: 16201
-
name: port-16301
protocol: TCP
port: 16301
targetPort: 16301
---
apiVersion: v1
kind: Pod
metadata:
name: hbase01
labels:
app: hbase
spec:
containers:
-
name: hbase
image: harisekhon/hbase:1.4
imagePullPolicy: IfNotPresent
ports:
-
name: port-2181
protocol: TCP
containerPort: 2181
-
name: port-8080
protocol: TCP
containerPort: 8080
-
name: port-8085
protocol: TCP
containerPort: 8085
-
name: port-9000
protocol: TCP
containerPort: 9000
-
name: port-9090
protocol: TCP
containerPort: 9090
-
name: port-9095
protocol: TCP
containerPort: 9095
-
name: port-16000
protocol: TCP
containerPort: 16000
-
name: port-16010
protocol: TCP
containerPort: 16010
-
name: port-16020
protocol: TCP
containerPort: 16020
-
name: port-16201
protocol: TCP
containerPort: 16201
-
name: port-16301
protocol: TCP
containerPort: 16301
这里的pod.matedata.name 要写入本地
/etc/hosts
127.0.0.1 hbase01
2 scala 连接测试
https://www.yuque.com/tiankonghewo/note/kum53k
3 建表
docker exec -it hbase bash
hbase shell
create 'student', 'cf'
put 'student','wsy','cf:height','180'
put 'student','wsy','cf:birthday','19900303'
put 'student','lucy','cf:height','165'
put 'student','lucy','cf:birthday','19921001'
desc 'student'
get 'student','wsy'
get 'student','lucy'
exit
scan 'ns1:t1',{COLUMNS=>['c1','c2'],LIMIT=>10,STARTROW=>'xyz'}
scan 'default:student',{COLUMNS=>['bizid'],LIMIT=>10}
参考链接: