Created
March 13, 2019 07:02
-
-
Save abhiesa/bc3799b7145c42e8a2833ae1f2faf763 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl expose deployment test --port=80 | |
113 kubectl get service | |
114 kubectl describe service test | |
115 kubectl get pods -o wide | |
116 kubectl edit deployments | |
117 kubectl get pods -o wide | |
118 kubectl describe service test | |
119 kubectl get pods -o wide | |
120 kubectl describe service test | |
121 kubectl get pods -o wide | |
122 curl 10.107.215.185 | |
kubectl expose deployment test --port=8000 --target-port=80 | |
cat myhttpd.yml | |
2 kubectl create -f myhttpd.yml | |
3 kubectl get pods | |
4 kubectl get pods -w | |
5 kubectl get pods --show-labels | |
6 cat srv.yml | |
7 kubectl create -f srv.yml | |
8 kubectl get service | |
9 kubectl describe serivce httpd-service | |
10 kubectl describe service httpd-service | |
11 kubectl get pods -o wide | |
12 vi myhttpd.yml | |
13 kubectl create -f myhttpd.yml | |
14 kubectl get pods -o wide | |
15 kubectl get pods -o wide -w | |
16 kubectl describe service httpd-service | |
17 vi myhttpd.yml | |
18 cat srv.yml | |
----- | |
[root@master ~]# cat myhttpd.yml | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: httpd1 | |
labels: | |
env: myhttpd | |
spec: | |
containers: | |
- name: httpd1 | |
image: httpd:latest | |
ports: | |
- containerPort: 80 | |
--------------- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: httpd-service | |
labels: | |
env: myhttpd-srv | |
spec: | |
ports: | |
- port: 80 | |
targetPort: 80 | |
type: NodePort | |
selector: | |
env: myhttpd | |
-------------------- | |
On Node
mkdir /data
43 chown nfsnobody:nfsnobody /data/
44 chmod 775 /data/
45 vi /etc/exports
46 exportfs -r
47 systemctl stop firewalld
49 systemctl disable firewalld
50 systemctl restart nfs-server
51 systemctl enable nfs-server
cat /etc/exports
/data/ *(rw,async,no_root_squash)
on master
mount -t nfs node.example.com:/data /mnt
umount /mnt
cat pv.yml
apiVersion: v1
kind: PersistentVolume
metadata:
name: mypv1
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
nfs:
server: node.example.com
path: "/data"
[root@master ~]# cat mypvc.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mypvc1
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
66 kubectl get configmap
67 kubectl edit configmap example-redis-config
68 kubectl get configmap example-redis-config -o yaml
69 vi redis.yml
70 kubectl create -f redis.yml
71 vi redis.yml
72 kubectl create -f redis.yml
73 kubectl get pods
74 kubectl get pods -w
75 kubectl get pods
76 kubectl exec -it redis bash
77 kubectl exec -it redis redis-cli